Skip to content

Commit

Permalink
Fix IE9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayFrantsev committed Apr 3, 2020
1 parent c7dfe98 commit 43d7765
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tc-string-parse",
"description": "Simple JavaScript parser for transparency and consent strings compatible with TCF 2.0.",
"version": "1.2.0",
"version": "1.2.1",
"repository": {
"type": "git",
"url": "https://github.com/audienceproject/tc-string-parse"
Expand All @@ -24,6 +24,7 @@
},
"dependencies": {},
"devDependencies": {
"Base64": "github:davidchambers/Base64.js",
"ava": "3.5.1",
"eslint": "6.8.0",
"uglify-js": "3.8.1"
Expand Down
7 changes: 6 additions & 1 deletion tc-string-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@
var reduceQueue = function (queue, schema, value, result) {
var reduceNumPubEntries = function () {
if (result.pubRestrictionEntry && result.rangeEntry) {
result.pubRestrictionEntry = Object.assign(result.pubRestrictionEntry, result.rangeEntry);
for (var key in result.rangeEntry) {
if (Object.prototype.hasOwnProperty.call(result.rangeEntry, key)) {
result.pubRestrictionEntry[key] = (result.pubRestrictionEntry[key] || []).
concat(result.rangeEntry[key]);
}
}
}

if (result.numPubRestrictions) {
Expand Down
3 changes: 3 additions & 0 deletions tc-string-parse.test.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!DOCTYPE html>

<script src="node_modules/Base64/base64.js"></script>
<script src="tc-string-parse.js"></script>

<script>
Expand Down
6 changes: 6 additions & 0 deletions tc-string-parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ ava("core vendor legitimate interests", (test) => {
});
});


ava("core publisher restrictions", (test) => {
test.deepEqual(test.context.empty.core.publisherRestrictions, {});
test.deepEqual(Object.keys(test.context.given.core.publisherRestrictions), ["8", "9", "11"]);
});

ava("disclosed vendors", (test) => {
test.is(Object.keys(test.context.example.disclosedVendors).length, 115);
});
Expand Down

0 comments on commit 43d7765

Please sign in to comment.