source: imaps-frontend/node_modules/@ungap/structured-clone/esm/json.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 690 bytes
Line 
1/*! (c) Andrea Giammarchi - ISC */
2
3import {deserialize} from './deserialize.js';
4import {serialize} from './serialize.js';
5
6const {parse: $parse, stringify: $stringify} = JSON;
7const options = {json: true, lossy: true};
8
9/**
10 * Revive a previously stringified structured clone.
11 * @param {string} str previously stringified data as string.
12 * @returns {any} whatever was previously stringified as clone.
13 */
14export const parse = str => deserialize($parse(str));
15
16/**
17 * Represent a structured clone value as string.
18 * @param {any} any some clone-able value to stringify.
19 * @returns {string} the value stringified.
20 */
21export const stringify = any => $stringify(serialize(any, options));
Note: See TracBrowser for help on using the repository browser.