main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
941 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 | const {deserialize} = require('./deserialize.js');
|
---|
| 3 | const {serialize} = require('./serialize.js');
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * @typedef {Array<string,any>} Record a type representation
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * Returns an array of serialized Records.
|
---|
| 11 | * @param {any} any a serializable value.
|
---|
| 12 | * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with
|
---|
| 13 | * a transfer option (ignored when polyfilled) and/or non standard fields that
|
---|
| 14 | * fallback to the polyfill if present.
|
---|
| 15 | * @returns {Record[]}
|
---|
| 16 | */
|
---|
| 17 | Object.defineProperty(exports, '__esModule', {value: true}).default = typeof structuredClone === "function" ?
|
---|
| 18 | /* c8 ignore start */
|
---|
| 19 | (any, options) => (
|
---|
| 20 | options && ('json' in options || 'lossy' in options) ?
|
---|
| 21 | deserialize(serialize(any, options)) : structuredClone(any)
|
---|
| 22 | ) :
|
---|
| 23 | (any, options) => deserialize(serialize(any, options));
|
---|
| 24 | /* c8 ignore stop */
|
---|
| 25 |
|
---|
| 26 | exports.deserialize = deserialize;
|
---|
| 27 | exports.serialize = serialize;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.