ohctechv3/.svn/pristine/5a/5a3d6f85239998bcb7205d8f991b70486319d1f1.svn-base
2024-10-28 15:03:36 +05:30

22 lines
690 B
Plaintext

/*! (c) Andrea Giammarchi - ISC */
import {deserialize} from './deserialize.js';
import {serialize} from './serialize.js';
const {parse: $parse, stringify: $stringify} = JSON;
const options = {json: true, lossy: true};
/**
* Revive a previously stringified structured clone.
* @param {string} str previously stringified data as string.
* @returns {any} whatever was previously stringified as clone.
*/
export const parse = str => deserialize($parse(str));
/**
* Represent a structured clone value as string.
* @param {any} any some clone-able value to stringify.
* @returns {string} the value stringified.
*/
export const stringify = any => $stringify(serialize(any, options));