src/index.js
function (dptid) {
        var baseId = null;
        var subId = null;

        // Parse the dpt id
        // If it is a raw number
        if (typeof dptid === 'number' && isFinite(dptid)) {
            // we're passed in a raw number (9)
            baseId = dptid;
            // If it is a string
        } else if (typeof dptid == 'string') {
            var m = dptid.toUpperCase().match(/(\d+)(\.(\d+))?/);
            baseId = parseInt(m[1]);
            if (m[3]) {
                subId = m[3];
            }
        }

        // Verify whether it exists
        if (baseId === null || !layouts[baseId] || (subId !== null && !layouts[baseId].subs[subId])) {
            console.trace("no such DPT: %j", dptid);
            throw "No such DPT";
        } else {
            return buildDPT(baseId, subId);
        }
    }
function (dptid) {
        var baseId = null;
        var subId = null;

        // Parse the dpt id
        // If it is a raw number
        if (typeof dptid === 'number' && isFinite(dptid)) {
            // we're passed in a raw number (9)
            baseId = dptid;
            // If it is a string
        } else if (typeof dptid == 'string') {
            var m = dptid.toUpperCase().match(/(\d+)(\.(\d+))?/);
            baseId = parseInt(m[1]);
            if (m[3]) {
                subId = m[3];
            }
        }

        // Verify whether it exists
        if (baseId === null || !layouts[baseId] || (subId !== null && !layouts[baseId].subs[subId])) {
            console.trace("no such DPT: %j", dptid);
            throw "No such DPT";
        } else {
            return buildDPT(baseId, subId);
        }
    }
function ( dptid ) { var baseId = null ; var subId = null ; // Parse the dpt id // If it is a raw number if ( typeof dptid === 'number' && isFinite ( dptid ) ) { // we're passed in a raw number (9) baseId = dptid ; // If it is a string } else if ( typeof dptid == 'string' ) { var m = dptid . toUpperCase ( ) . match ( / (\d+)(\.(\d+))? / ) ; baseId = parseInt ( m [ 1 ] ) ; if ( m [ 3 ] ) { subId = m [ 3 ] ; } } // Verify whether it exists if ( baseId === null || ! layouts [ baseId ] || ( subId !== null && ! layouts [ baseId ] . subs [ subId ] ) ) { console . trace ( "no such DPT: %j" , dptid ) ; throw "No such DPT" ; } else { return buildDPT ( baseId , subId ) ; } }
a generic DPT resolution function
@param dptid The datapoint id. Allowed formats: 9/"9"/"9.001"/"DPT9.001"
a generic DPT resolution function