Skip to content

Commit 43d7765

Browse files
Fix IE9 compatibility
1 parent c7dfe98 commit 43d7765

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tc-string-parse",
33
"description": "Simple JavaScript parser for transparency and consent strings compatible with TCF 2.0.",
4-
"version": "1.2.0",
4+
"version": "1.2.1",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/audienceproject/tc-string-parse"
@@ -24,6 +24,7 @@
2424
},
2525
"dependencies": {},
2626
"devDependencies": {
27+
"Base64": "github:davidchambers/Base64.js",
2728
"ava": "3.5.1",
2829
"eslint": "6.8.0",
2930
"uglify-js": "3.8.1"

tc-string-parse.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@
249249
var reduceQueue = function (queue, schema, value, result) {
250250
var reduceNumPubEntries = function () {
251251
if (result.pubRestrictionEntry && result.rangeEntry) {
252-
result.pubRestrictionEntry = Object.assign(result.pubRestrictionEntry, result.rangeEntry);
252+
for (var key in result.rangeEntry) {
253+
if (Object.prototype.hasOwnProperty.call(result.rangeEntry, key)) {
254+
result.pubRestrictionEntry[key] = (result.pubRestrictionEntry[key] || []).
255+
concat(result.rangeEntry[key]);
256+
}
257+
}
253258
}
254259

255260
if (result.numPubRestrictions) {

tc-string-parse.test.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<!DOCTYPE html>
2+
3+
<script src="node_modules/Base64/base64.js"></script>
14
<script src="tc-string-parse.js"></script>
25

36
<script>

tc-string-parse.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ ava("core vendor legitimate interests", (test) => {
120120
});
121121
});
122122

123+
124+
ava("core publisher restrictions", (test) => {
125+
test.deepEqual(test.context.empty.core.publisherRestrictions, {});
126+
test.deepEqual(Object.keys(test.context.given.core.publisherRestrictions), ["8", "9", "11"]);
127+
});
128+
123129
ava("disclosed vendors", (test) => {
124130
test.is(Object.keys(test.context.example.disclosedVendors).length, 115);
125131
});

0 commit comments

Comments
 (0)