plugins/polling-updater.js
function createTag(tagData, platform, factory) {
    let mgrData = {};
    managerProps.forEach((k) => {
        let mk = k.replace(/^manager([A-Z])/, '$1');
        if (mk !== k) mk = mk.toLowerCase();
        mgrData[mk] = tagData[k];
        delete tagData[k];
    });
    if (! platform) platform = {};
    if (! factory) factory = platform.factory;
    if (! factory) throw new TypeError("must have valid platform object or "
                                       + "object factory in discovery mode");
    let mgrProm = platform.findTagManager ?
        platform.findTagManager(mgrData.mac) :
        Promise.resolve(factory.createTagManager(mgrData));
    return mgrProm.then((mgr) => {
        if (! mgr) throw new Error("no such tag manager: " + mgrData.mac);
        return factory.createTag(mgr, tagData);
    });
}
function createTag(tagData, platform, factory) {
    let mgrData = {};
    managerProps.forEach((k) => {
        let mk = k.replace(/^manager([A-Z])/, '$1');
        if (mk !== k) mk = mk.toLowerCase();
        mgrData[mk] = tagData[k];
        delete tagData[k];
    });
    if (! platform) platform = {};
    if (! factory) factory = platform.factory;
    if (! factory) throw new TypeError("must have valid platform object or "
                                       + "object factory in discovery mode");
    let mgrProm = platform.findTagManager ?
        platform.findTagManager(mgrData.mac) :
        Promise.resolve(factory.createTagManager(mgrData));
    return mgrProm.then((mgr) => {
        if (! mgr) throw new Error("no such tag manager: " + mgrData.mac);
        return factory.createTag(mgr, tagData);
    });
}
function createTag ( tagData , platform , factory ) { let mgrData = { } ; managerProps . forEach ( ( k ) => { let mk = k . replace ( / ^manager([A-Z]) / , '$1' ) ; if ( mk !== k ) mk = mk . toLowerCase ( ) ; mgrData [ mk ] = tagData [ k ] ; delete tagData [ k ] ; } ) ; if ( ! platform ) platform = { } ; if ( ! factory ) factory = platform . factory ; if ( ! factory ) throw new TypeError ( "must have valid platform object or " + "object factory in discovery mode" ) ; let mgrProm = platform . findTagManager ? platform . findTagManager ( mgrData . mac ) : Promise . resolve ( factory . createTagManager ( mgrData ) ) ; return mgrProm . then ( ( mgr ) => { if ( ! mgr ) throw new Error ( "no such tag manager: " + mgrData . mac ) ; return factory . createTag ( mgr , tagData ) ; } ) ; }
Creates a tag object from the given attribute data object, and returns it.

@param {object} tagData - the attribute data object as returned by
the polling API endpoint
@param {WirelessTagPlatform} platform - the platform instance for
creating tag and tag manager objects. If the value does
not provide a factory, `factory` must be provided.
@param {WirelessTagPlatform~factory} [factory] - the tag and tag
manager object factory to use
@returns {WirelessTag}
@private
Creates a tag object from the given attribute data object and returns it .