source: imaps-frontend/node_modules/@ungap/structured-clone/cjs/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: 754 bytes
RevLine 
[d565449]1'use strict';
2/*! (c) Andrea Giammarchi - ISC */
3
4const {deserialize} = require('./deserialize.js');
5const {serialize} = require('./serialize.js');
6
7const {parse: $parse, stringify: $stringify} = JSON;
8const options = {json: true, lossy: true};
9
10/**
11 * Revive a previously stringified structured clone.
12 * @param {string} str previously stringified data as string.
13 * @returns {any} whatever was previously stringified as clone.
14 */
15const parse = str => deserialize($parse(str));
16exports.parse = parse;
17
18/**
19 * Represent a structured clone value as string.
20 * @param {any} any some clone-able value to stringify.
21 * @returns {string} the value stringified.
22 */
23const stringify = any => $stringify(serialize(any, options));
24exports.stringify = stringify;
Note: See TracBrowser for help on using the repository browser.