GDPR consent string validation library
npm install has-consent
npm install has-consent --save-dev/dist directory. Both minified and non-minified copies are written, but the minified version is returned by the main property. Has-Consent should be referenced and included in your bundle, and is not intended to be dropped straight on to a web page.``javascript
const { ConsentStringParser } = require("has-consent");
const MY_VENDOR_ID = 7;
const consent = new ConsentStringParser("BN5lERiOMYEdiAOAWeFRAAYAAaAAptQ");
consent.vendorAllowed(MY_VENDOR_ID); // true
``
This library also handles purposes validation. You can read more about the supported methods in the API documentation;