Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

consent-string

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consent-string - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

145

dist/consent-string.js

@@ -7,147 +7,2 @@ 'use strict';

var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -154,0 +9,0 @@

'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
var _require = require('./utils/bits'),

@@ -151,0 +4,0 @@ decodeBitsToIds = _require.decodeBitsToIds,

174

dist/encode.js
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return _arrayFrom(arr); } }
var _require = require('./utils/bits'),

@@ -187,9 +38,11 @@ encodeToBase64 = _require.encodeToBase64,

var maxPurposeId = Math.max.apply(Math, [0].concat(_toConsumableArray(purposes.map(function (_ref) {
var id = _ref.id;
return id;
})), _toConsumableArray(_arrayFrom(allowedPurposeIds))));
var maxPurposeId = 0;
for (var i = 0; i < purposes.length; i += 1) {
maxPurposeId = Math.max(maxPurposeId, purposes[i].id);
}
for (var _i = 0; _i < allowedPurposeIds.length; _i += 1) {
maxPurposeId = Math.max(maxPurposeId, allowedPurposeIds[_i]);
}
var purposeString = '';
for (var id = 1; id <= maxPurposeId; id += 1) {

@@ -210,2 +63,3 @@ purposeString += allowedPurposeIds.indexOf(id) !== -1 ? '1' : '0';

var range = [];
var ranges = [];

@@ -216,4 +70,4 @@ var idsInList = vendors.map(function (vendor) {

return vendors.reduce(function (acc, _ref2, index) {
var id = _ref2.id;
for (var index = 0; index < vendors.length; index += 1) {
var id = vendors[index].id;

@@ -234,11 +88,11 @@ if (allowedVendorIds.indexOf(id) !== -1) {

return [].concat(_toConsumableArray(acc), [{
ranges.push({
isRange: typeof endVendorId === 'number',
startVendorId: startVendorId,
endVendorId: endVendorId
}]);
});
}
}
return acc;
}, []);
return ranges;
}

@@ -245,0 +99,0 @@

'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
var _require = require('./consent-string'),

@@ -151,0 +4,0 @@ ConsentString = _require.ConsentString;

'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
/* eslint no-use-before-define: off */

@@ -151,0 +4,0 @@

'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _arrayFrom = Array.from || function () {
var isCallable = function isCallable(fn) {
return typeof fn === 'function';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
var iteratorProp = function iteratorProp(value) {
if (value != null) {
if (['string', 'number', 'boolean', 'symbol'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1) {
return Symbol.iterator;
} else if (typeof Symbol !== 'undefined' && 'iterator' in Symbol && Symbol.iterator in value) {
return Symbol.iterator;
} else if ('@@iterator' in value) {
return '@@iterator';
}
}
};
var getMethod = function getMethod(O, P) {
if (O != null && P != null) {
var func = O[P];
if (func == null) {
return void 0;
}
if (!isCallable(func)) {
throw new TypeError(func + " is not a function");
}
return func;
}
};
var iteratorStep = function iteratorStep(iterator) {
var result = iterator.next();
var done = Boolean(result.done);
if (done) {
return false;
}
return result;
};
return function from(items) {
"use strict";
var C = this;
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var A, k;
var usingIterator = getMethod(items, iteratorProp(items));
if (usingIterator !== void 0) {
A = isCallable(C) ? Object(new C()) : [];
var iterator = usingIterator.call(items);
if (iterator == null) {
throw new TypeError("Array.from requires an array-like or iterable object");
}
k = 0;
var next, nextValue;
while (true) {
next = iteratorStep(iterator);
if (!next) {
A.length = k;
return A;
}
nextValue = next.value;
if (mapFn) {
A[k] = mapFn.call(T, nextValue, k);
} else {
A[k] = nextValue;
}
k++;
}
} else {
var arrayLike = Object(items);
if (items == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
var len = toLength(arrayLike.length);
A = isCallable(C) ? Object(new C(len)) : new Array(len);
k = 0;
var kValue;
while (k < len) {
kValue = arrayLike[k];
if (mapFn) {
A[k] = mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k++;
}
A.length = len;
}
return A;
};
}();
/**

@@ -151,0 +4,0 @@ * Number of bits for encoding the version integer

3

package.json
{
"name": "consent-string",
"version": "1.3.1",
"version": "1.3.2",
"description": "Encode and decode web-safe base64 consent information with the IAB EU's GDPR Transparency and Consent Framework",

@@ -35,3 +35,2 @@ "homepage": "https://github.com/InteractiveAdvertisingBureau/Consent-String-SDK-JS",

"babel-cli": "^6.26.0",
"@59naga/babel-plugin-transform-array-from": "0.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",

@@ -38,0 +37,0 @@ "babel-plugin-transform-es2015-arrow-functions": "^6.22.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc