consent-string
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -150,4 +150,2 @@ 'use strict'; | ||
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); } } | ||
/* eslint no-use-before-define: off */ | ||
@@ -329,9 +327,2 @@ | ||
var listEntryCount = 0; | ||
if (typeof listCount === 'function') { | ||
listEntryCount = listCount(output); | ||
} else if (typeof listCount === 'number') { | ||
listEntryCount = listCount; | ||
} | ||
switch (type) { | ||
@@ -347,16 +338,3 @@ case 'int': | ||
case 'list': | ||
return new Array(listEntryCount).fill().reduce(function (acc) { | ||
var _decodeFields = decodeFields({ | ||
input: input, | ||
fields: field.fields, | ||
startPosition: acc.newPosition | ||
}), | ||
decodedObject = _decodeFields.decodedObject, | ||
newPosition = _decodeFields.newPosition; | ||
return { | ||
fieldValue: [].concat(_toConsumableArray(acc.fieldValue), [decodedObject]), | ||
newPosition: newPosition | ||
}; | ||
}, { fieldValue: [], newPosition: startPosition }); | ||
return decodeList(input, output, startPosition, field, listCount); | ||
case 'language': | ||
@@ -369,2 +347,28 @@ return { fieldValue: decodeBitsToLanguage(input, startPosition, bitCount) }; | ||
function decodeList(input, output, startPosition, field, listCount) { | ||
var listEntryCount = 0; | ||
if (typeof listCount === 'function') { | ||
listEntryCount = listCount(output); | ||
} else if (typeof listCount === 'number') { | ||
listEntryCount = listCount; | ||
} | ||
var newPosition = startPosition; | ||
var fieldValue = []; | ||
for (var i = 0; i < listEntryCount; i += 1) { | ||
var decodedFields = decodeFields({ | ||
input: input, | ||
fields: field.fields, | ||
startPosition: newPosition | ||
}); | ||
newPosition = decodedFields.newPosition; | ||
fieldValue.push(decodedFields.decodedObject); | ||
} | ||
return { fieldValue: fieldValue, newPosition: newPosition }; | ||
} | ||
function decodeFields(_ref4) { | ||
@@ -467,4 +471,4 @@ var input = _ref4.input, | ||
var _decodeFields2 = decodeFields({ input: bitString, fields: fields }), | ||
decodedObject = _decodeFields2.decodedObject; | ||
var _decodeFields = decodeFields({ input: bitString, fields: fields }), | ||
decodedObject = _decodeFields.decodedObject; | ||
@@ -471,0 +475,0 @@ return decodedObject; |
{ | ||
"name": "consent-string", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Encode and decode web-safe base64 consent information with the IAB EU's GDPR Transparency and Consent Framework", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/InteractiveAdvertisingBureau/Consent-String-SDK-JS", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1738
75994