## Modules
HasConsent
## Classes
ConsentStringParser
## HasConsent ## ConsentStringParser **Kind**: global class * [ConsentStringParser](#ConsentStringParser) * [new ConsentStringParser()](#new_ConsentStringParser_new) * [.module.exports](#ConsentStringParser.module.exports) * [new module.exports(consentString)](#new_ConsentStringParser.module.exports_new) * [.cmpID](#ConsentStringParser.cmpID) : Number * [.cmpVersion](#ConsentStringParser.cmpVersion) : Number * [.vendorEncodingType](#ConsentStringParser.vendorEncodingType) : Number * [.version](#ConsentStringParser.version) : Number * [.purposeAllowed(purposeID)](#ConsentStringParser.purposeAllowed) ⇒ Boolean * [.vendorAllowed(vendorID)](#ConsentStringParser.vendorAllowed) ⇒ Boolean * [._getBit(offset)](#ConsentStringParser._getBit) ⇒ Number * [._getInt(offset, size)](#ConsentStringParser._getInt) ⇒ Number * [._processPurposes()](#ConsentStringParser._processPurposes) * [._processVendorsList()](#ConsentStringParser._processVendorsList) * [._vendorInRange(vendorID)](#ConsentStringParser._vendorInRange) ⇒ Boolean ### new ConsentStringParser() Parser instance for processing IAB consent strings ### ConsentStringParser.module.exports **Kind**: static class of [ConsentStringParser](#ConsentStringParser) #### new module.exports(consentString) Constructor for the parser **Throws**: - Error Throws for invalid consent strings | Param | Type | Description | | --- | --- | --- | | consentString | String | The consent string | ### ConsentStringParser.cmpID : Number CMP ID **Kind**: static property of [ConsentStringParser](#ConsentStringParser) **Read only**: true ### ConsentStringParser.cmpVersion : Number CMP version **Kind**: static property of [ConsentStringParser](#ConsentStringParser) **Read only**: true ### ConsentStringParser.vendorEncodingType : Number The encoding type used for the vendor(s) list **Kind**: static property of [ConsentStringParser](#ConsentStringParser) **Read only**: true ### ConsentStringParser.version : Number The consent string version used by the CMP **Kind**: static property of [ConsentStringParser](#ConsentStringParser) **Read only**: true ### ConsentStringParser.purposeAllowed(purposeID) ⇒ Boolean Check if a purpose is allowed **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Returns**: Boolean - True if the purpose is allowed, false otherwise | Param | Type | Description | | --- | --- | --- | | purposeID | Number | The ID of the purpose to check | ### ConsentStringParser.vendorAllowed(vendorID) ⇒ Boolean Check if a vendor is allowed **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Returns**: Boolean - True if the vendor is allowed, false otherwise | Param | Type | Description | | --- | --- | --- | | vendorID | Number | The ID of the vendor to check | ### ConsentStringParser._getBit(offset) ⇒ Number Get a bit of data from the parsed consent string **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Returns**: Number - The requested bit **Access**: protected | Param | Type | Description | | --- | --- | --- | | offset | Number | The offset to fetch from | ### ConsentStringParser._getInt(offset, size) ⇒ Number Get a number from the parsed consent data Takes a range of bits and converts them into an integer **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Returns**: Number - The integer value of the bit range **Access**: protected | Param | Type | Description | | --- | --- | --- | | offset | Number | The offset to read from | | size | Number | The amount of bits to read | ### ConsentStringParser._processPurposes() Process purposes from allowed purposes ID range **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Access**: protected ### ConsentStringParser._processVendorsList() Process the vendors list by creating ranges of vendor IDs **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Access**: protected ### ConsentStringParser._vendorInRange(vendorID) ⇒ Boolean Check if a vendor ID appears in any ID range **Kind**: static method of [ConsentStringParser](#ConsentStringParser) **Returns**: Boolean - True if the vendor ID appears in a range, false otherwise **Access**: protected | Param | Type | Description | | --- | --- | --- | | vendorID | Number | The vendor ID number |