@dotdev/next-components
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -46,3 +46,13 @@ "use strict"; | ||
var scriptProperty = scriptTag.getAttribute("data-property"); | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
var scriptData = validateJSON(scriptTag.innerHTML); | ||
function validateJSON(json) { | ||
var scriptData = {}; | ||
try { | ||
scriptData = JSON.parse(json); | ||
} | ||
catch (error) { | ||
console.log(error), console.log(json); | ||
} | ||
return scriptData; | ||
} | ||
var objectKey = scriptProperty.includes(".") | ||
@@ -66,3 +76,14 @@ ? scriptProperty.split(".")[1] | ||
var scriptProperty = scriptTag.getAttribute("data-property"); | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
var scriptData = validateJSON(scriptTag.innerHTML); | ||
function validateJSON(json) { | ||
var scriptData = {}; | ||
try { | ||
scriptData = JSON.parse(json); | ||
} | ||
catch (error) { | ||
console.log(error), console.log(json); | ||
} | ||
return scriptData; | ||
} | ||
//@ts-ignore | ||
return scriptData.type == "static" | ||
@@ -72,3 +93,14 @@ ? __assign({}, result, (_a = {}, _a[scriptProperty] = scriptData, _a)) : result; | ||
var dynamicSections = Object.values(scriptTags).reduce(function (result, scriptTag) { | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
var scriptData = validateJSON(scriptTag.innerHTML); | ||
function validateJSON(json) { | ||
var scriptData = {}; | ||
try { | ||
scriptData = JSON.parse(json); | ||
} | ||
catch (error) { | ||
console.log(error), console.log(json); | ||
} | ||
return scriptData; | ||
} | ||
//@ts-ignore | ||
return scriptData.type == "dynamic" ? result.concat([scriptData]) : result; | ||
@@ -75,0 +107,0 @@ }, []); |
{ | ||
"name": "@dotdev/next-components", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"license": "SEE LICENSE IN LICENCE.md", | ||
@@ -37,3 +37,3 @@ "description": "Common components for Next projects", | ||
"build": "tsc --project tsconfig.json", | ||
"prepublish": "rm -rf ./dist && npm run build" | ||
"prepublishOnly": "rm -rf ./dist && npm run build" | ||
}, | ||
@@ -40,0 +40,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
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
130151
1879