From 43d7765f00ab1c69501cf4859fcad61bc1683d45 Mon Sep 17 00:00:00 2001 From: Nikolay Frantsev Date: Fri, 3 Apr 2020 14:58:58 +0300 Subject: [PATCH] Fix IE9 compatibility --- package.json | 3 ++- tc-string-parse.js | 7 ++++++- tc-string-parse.test.html | 3 +++ tc-string-parse.test.js | 6 ++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 88a049e..76bb5db 100644 --- a/package.json +++ b/package.json @@ -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" @@ -24,6 +24,7 @@ }, "dependencies": {}, "devDependencies": { + "Base64": "github:davidchambers/Base64.js", "ava": "3.5.1", "eslint": "6.8.0", "uglify-js": "3.8.1" diff --git a/tc-string-parse.js b/tc-string-parse.js index 9de7ea8..289b309 100644 --- a/tc-string-parse.js +++ b/tc-string-parse.js @@ -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) { diff --git a/tc-string-parse.test.html b/tc-string-parse.test.html index 6fc109b..e50d01f 100644 --- a/tc-string-parse.test.html +++ b/tc-string-parse.test.html @@ -1,3 +1,6 @@ + + +