Skip to content

Latest commit

 

History

History
169 lines (120 loc) · 5.82 KB

File metadata and controls

169 lines (120 loc) · 5.82 KB

Modules

HasConsent

Classes

ConsentStringParser

HasConsent

ConsentStringParser

Kind: global class

new ConsentStringParser()

Parser instance for processing IAB consent strings

ConsentStringParser.module.exports

Kind: static class of 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
Read only: true

ConsentStringParser.cmpVersion : Number

CMP version

Kind: static property of ConsentStringParser
Read only: true

ConsentStringParser.vendorEncodingType : Number

The encoding type used for the vendor(s) list

Kind: static property of ConsentStringParser
Read only: true

ConsentStringParser.version : Number

The consent string version used by the CMP

Kind: static property of ConsentStringParser
Read only: true

ConsentStringParser.purposeAllowed(purposeID) ⇒ Boolean

Check if a purpose is allowed

Kind: static method of 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
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
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
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
Access: protected

ConsentStringParser._processVendorsList()

Process the vendors list by creating ranges of vendor IDs

Kind: static method of ConsentStringParser
Access: protected

ConsentStringParser._vendorInRange(vendorID) ⇒ Boolean

Check if a vendor ID appears in any ID range

Kind: static method of 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