chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 564 forks source link

add isType helper #103

Closed don closed 10 years ago

don commented 10 years ago
function isType(record, tnf, rtd) {
    if (record.tnf === tnf) { // TNF is 3-bit
        var recordType;
        if (typeof(rtd) === 'string') {
            recordType = rtd;
        } else {
            recordType = nfc.bytesToString(rtd);
        }
        return (nfc.bytesToString(record.type) === recordType);
    }
    return false;
}