@memberjunction/global
Advanced tools
Comparing version 1.7.1 to 1.8.0
@@ -26,2 +26,8 @@ /** | ||
export declare function CleanJavaScript(javaScriptCode: string): string; | ||
/** | ||
* Simple wrapper method to JSON.parse that catches any errors and logs them to the console. This method is useful when you want to parse JSON but don't want to crash the application if the JSON is invalid. | ||
* @param jsonString | ||
* @returns | ||
*/ | ||
export declare function SafeJSONParse<T>(jsonString: string): T; | ||
//# sourceMappingURL=util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CleanJavaScript = exports.CleanJSON = exports.CopyScalarsAndArrays = exports.GetGlobalObjectStore = void 0; | ||
exports.SafeJSONParse = exports.CleanJavaScript = exports.CleanJSON = exports.CopyScalarsAndArrays = exports.GetGlobalObjectStore = void 0; | ||
/** | ||
@@ -141,2 +141,17 @@ * The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared | ||
exports.CleanJavaScript = CleanJavaScript; | ||
/** | ||
* Simple wrapper method to JSON.parse that catches any errors and logs them to the console. This method is useful when you want to parse JSON but don't want to crash the application if the JSON is invalid. | ||
* @param jsonString | ||
* @returns | ||
*/ | ||
function SafeJSONParse(jsonString) { | ||
try { | ||
return JSON.parse(jsonString); | ||
} | ||
catch (e) { | ||
console.error("Error parsing JSON string:", e); | ||
return null; | ||
} | ||
} | ||
exports.SafeJSONParse = SafeJSONParse; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@memberjunction/global", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "MemberJunction: Global Object - Needed for ALL other MJ components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
60645
779