This commit is contained in:
2026-03-18 17:37:24 +01:00
parent f6db3ab866
commit eec0df83cd
79 changed files with 2333 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
/**
* # EJSON parse string
*/
function parse(string, reviver) {
if (!string)
return undefined;
if (typeof string == "object")
return string;
if (typeof string !== "string")
return undefined;
try {
return JSON.parse(string, reviver);
}
catch (error) {
return undefined;
}
}
/**
* # EJSON stringify object
*/
function stringify(value, replacer, space) {
try {
return JSON.stringify(value, replacer || undefined, space);
}
catch (error) {
return undefined;
}
}
const EJSON = {
parse,
stringify,
};
export default EJSON;