mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-09-02 18:44:46 +08:00
chore: updating deps
This commit is contained in:
+8
-4
@@ -6,6 +6,14 @@
|
||||
|
||||
<sup>**Social Media Photo by [Matt Seymour](https://unsplash.com/@mattseymour) on [Unsplash](https://unsplash.com/)**</sup>
|
||||
|
||||
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
|
||||
|
||||
Available also for **[PHP](./php/flatted.php)**.
|
||||
|
||||
Available also for **[Python](./python/flatted.py)**.
|
||||
|
||||
- - -
|
||||
|
||||
## Announcement 📣
|
||||
|
||||
There is a standard approach to recursion and more data-types than what JSON allows, and it's part of the [Structured Clone polyfill](https://github.com/ungap/structured-clone/#readme).
|
||||
@@ -18,10 +26,6 @@ However, if recursion, as well as more data-types, are what you are after, or in
|
||||
|
||||
- - -
|
||||
|
||||
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
|
||||
|
||||
Now available also for **[PHP](./php/flatted.php)**.
|
||||
|
||||
```js
|
||||
npm i flatted
|
||||
```
|
||||
|
||||
+29
-3
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
/*! (c) 2020 Andrea Giammarchi */
|
||||
/// <reference types="../types/index.d.ts" />
|
||||
|
||||
// (c) 2020-present Andrea Giammarchi
|
||||
|
||||
const {parse: $parse, stringify: $stringify} = JSON;
|
||||
const {keys} = Object;
|
||||
@@ -51,6 +53,12 @@ const set = (known, input, value) => {
|
||||
return index;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a specialized flatted string into a JS value.
|
||||
* @param {string} text
|
||||
* @param {((this: any, key: string, value: any) => any) | undefined): any} [reviver]
|
||||
* @returns {any}
|
||||
*/
|
||||
const parse = (text, reviver) => {
|
||||
const input = $parse(text, Primitives).map(primitives);
|
||||
const value = input[0];
|
||||
@@ -62,6 +70,13 @@ const parse = (text, reviver) => {
|
||||
};
|
||||
exports.parse = parse;
|
||||
|
||||
/**
|
||||
* Converts a JS value into a specialized flatted string.
|
||||
* @param {any} value
|
||||
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
|
||||
* @param {string | number | undefined} [space]
|
||||
* @returns {string}
|
||||
*/
|
||||
const stringify = (value, replacer, space) => {
|
||||
const $ = replacer && typeof replacer === object ?
|
||||
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
||||
@@ -93,7 +108,18 @@ const stringify = (value, replacer, space) => {
|
||||
};
|
||||
exports.stringify = stringify;
|
||||
|
||||
const toJSON = any => $parse(stringify(any));
|
||||
/**
|
||||
* Converts a generic value into a JSON serializable object without losing recursion.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
const toJSON = value => $parse(stringify(value));
|
||||
exports.toJSON = toJSON;
|
||||
const fromJSON = any => parse($stringify(any));
|
||||
|
||||
/**
|
||||
* Converts a previously serialized object with recursion into a recursive one.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
const fromJSON = value => parse($stringify(value));
|
||||
exports.fromJSON = fromJSON;
|
||||
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
self.Flatted=function(t){"use strict";
|
||||
/*! (c) 2020 Andrea Giammarchi */const{parse:e,stringify:n}=JSON,{keys:r}=Object,s=String,o="string",c={},l="object",a=(t,e)=>e,f=t=>t instanceof s?s(t):t,i=(t,e)=>typeof e===o?new s(e):e,u=(t,e,n,o)=>{const a=[];for(let f=r(n),{length:i}=f,u=0;u<i;u++){const r=f[u],i=n[r];if(i instanceof s){const s=t[i];typeof s!==l||e.has(s)?n[r]=o.call(n,r,s):(e.add(s),n[r]=c,a.push({k:r,a:[t,e,s,o]}))}else n[r]!==c&&(n[r]=o.call(n,r,i))}for(let{length:t}=a,e=0;e<t;e++){const{k:t,a:r}=a[e];n[t]=o.call(n,t,u.apply(null,r))}return n},p=(t,e,n)=>{const r=s(e.push(n)-1);return t.set(n,r),r},y=(t,n)=>{const r=e(t,i).map(f),s=r[0],o=n||a,c=typeof s===l&&s?u(r,new Set,s,o):s;return o.call({"":c},"",c)},g=(t,e,r)=>{const s=e&&typeof e===l?(t,n)=>""===t||-1<e.indexOf(t)?n:void 0:e||a,c=new Map,f=[],i=[];let u=+p(c,f,s.call({"":t},"",t)),y=!u;for(;u<f.length;)y=!0,i[u]=n(f[u++],g,r);return"["+i.join(",")+"]";function g(t,e){if(y)return y=!y,e;const n=s.call(this,t,e);switch(typeof n){case l:if(null===n)return n;case o:return c.get(n)||p(c,f,n)}return n}};return t.fromJSON=t=>y(n(t)),t.parse=y,t.stringify=g,t.toJSON=t=>e(g(t)),t}({});
|
||||
self.Flatted=function(t){"use strict";const{parse:e,stringify:n}=JSON,{keys:r}=Object,s=String,o="string",c={},l="object",a=(t,e)=>e,f=t=>t instanceof s?s(t):t,i=(t,e)=>typeof e===o?new s(e):e,u=(t,e,n,o)=>{const a=[];for(let f=r(n),{length:i}=f,u=0;u<i;u++){const r=f[u],i=n[r];if(i instanceof s){const s=t[i];typeof s!==l||e.has(s)?n[r]=o.call(n,r,s):(e.add(s),n[r]=c,a.push({k:r,a:[t,e,s,o]}))}else n[r]!==c&&(n[r]=o.call(n,r,i))}for(let{length:t}=a,e=0;e<t;e++){const{k:t,a:r}=a[e];n[t]=o.call(n,t,u.apply(null,r))}return n},p=(t,e,n)=>{const r=s(e.push(n)-1);return t.set(n,r),r},y=(t,n)=>{const r=e(t,i).map(f),s=r[0],o=n||a,c=typeof s===l&&s?u(r,new Set,s,o):s;return o.call({"":c},"",c)},g=(t,e,r)=>{const s=e&&typeof e===l?(t,n)=>""===t||-1<e.indexOf(t)?n:void 0:e||a,c=new Map,f=[],i=[];let u=+p(c,f,s.call({"":t},"",t)),y=!u;for(;u<f.length;)y=!0,i[u]=n(f[u++],g,r);return"["+i.join(",")+"]";function g(t,e){if(y)return y=!y,e;const n=s.call(this,t,e);switch(typeof n){case l:if(null===n)return n;case o:return c.get(n)||p(c,f,n)}return n}};return t.fromJSON=t=>y(n(t)),t.parse=y,t.stringify=g,t.toJSON=t=>e(g(t)),t}({});
|
||||
|
||||
+29
-3
@@ -1,4 +1,6 @@
|
||||
/*! (c) 2020 Andrea Giammarchi */
|
||||
/// <reference types="../types/index.d.ts" />
|
||||
|
||||
// (c) 2020-present Andrea Giammarchi
|
||||
|
||||
const {parse: $parse, stringify: $stringify} = JSON;
|
||||
const {keys} = Object;
|
||||
@@ -50,6 +52,12 @@ const set = (known, input, value) => {
|
||||
return index;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a specialized flatted string into a JS value.
|
||||
* @param {string} text
|
||||
* @param {(this: any, key: string, value: any) => any} [reviver]
|
||||
* @returns {any}
|
||||
*/
|
||||
export const parse = (text, reviver) => {
|
||||
const input = $parse(text, Primitives).map(primitives);
|
||||
const value = input[0];
|
||||
@@ -60,6 +68,13 @@ export const parse = (text, reviver) => {
|
||||
return $.call({'': tmp}, '', tmp);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a JS value into a specialized flatted string.
|
||||
* @param {any} value
|
||||
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
|
||||
* @param {string | number | undefined} [space]
|
||||
* @returns {string}
|
||||
*/
|
||||
export const stringify = (value, replacer, space) => {
|
||||
const $ = replacer && typeof replacer === object ?
|
||||
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
||||
@@ -90,5 +105,16 @@ export const stringify = (value, replacer, space) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const toJSON = any => $parse(stringify(any));
|
||||
export const fromJSON = any => parse($stringify(any));
|
||||
/**
|
||||
* Converts a generic value into a JSON serializable object without losing recursion.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
export const toJSON = value => $parse(stringify(value));
|
||||
|
||||
/**
|
||||
* Converts a previously serialized object with recursion into a recursive one.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
export const fromJSON = value => parse($stringify(value));
|
||||
|
||||
+43
-32
@@ -1,49 +1,44 @@
|
||||
self.Flatted = (function (exports) {
|
||||
'use strict';
|
||||
|
||||
function _typeof(obj) {
|
||||
function _typeof(o) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
}, _typeof(obj);
|
||||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
||||
return typeof o;
|
||||
} : function (o) {
|
||||
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
||||
}, _typeof(o);
|
||||
}
|
||||
|
||||
/*! (c) 2020 Andrea Giammarchi */
|
||||
/// <reference types="../types/index.d.ts" />
|
||||
|
||||
// (c) 2020-present Andrea Giammarchi
|
||||
|
||||
var $parse = JSON.parse,
|
||||
$stringify = JSON.stringify;
|
||||
$stringify = JSON.stringify;
|
||||
var keys = Object.keys;
|
||||
var Primitive = String; // it could be Number
|
||||
|
||||
var primitive = 'string'; // it could be 'number'
|
||||
|
||||
var ignore = {};
|
||||
var object = 'object';
|
||||
|
||||
var noop = function noop(_, value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
var primitives = function primitives(value) {
|
||||
return value instanceof Primitive ? Primitive(value) : value;
|
||||
};
|
||||
|
||||
var Primitives = function Primitives(_, value) {
|
||||
return _typeof(value) === primitive ? new Primitive(value) : value;
|
||||
};
|
||||
|
||||
var revive = function revive(input, parsed, output, $) {
|
||||
var lazy = [];
|
||||
|
||||
for (var ke = keys(output), length = ke.length, y = 0; y < length; y++) {
|
||||
var k = ke[y];
|
||||
var value = output[k];
|
||||
|
||||
if (value instanceof Primitive) {
|
||||
var tmp = input[value];
|
||||
|
||||
if (_typeof(tmp) === object && !parsed.has(tmp)) {
|
||||
parsed.add(tmp);
|
||||
output[k] = ignore;
|
||||
@@ -54,23 +49,26 @@ self.Flatted = (function (exports) {
|
||||
} else output[k] = $.call(output, k, tmp);
|
||||
} else if (output[k] !== ignore) output[k] = $.call(output, k, value);
|
||||
}
|
||||
|
||||
for (var _length = lazy.length, i = 0; i < _length; i++) {
|
||||
var _lazy$i = lazy[i],
|
||||
_k = _lazy$i.k,
|
||||
a = _lazy$i.a;
|
||||
_k = _lazy$i.k,
|
||||
a = _lazy$i.a;
|
||||
output[_k] = $.call(output, _k, revive.apply(null, a));
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
var set = function set(known, input, value) {
|
||||
var index = Primitive(input.push(value) - 1);
|
||||
known.set(value, index);
|
||||
return index;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a specialized flatted string into a JS value.
|
||||
* @param {string} text
|
||||
* @param {((this: any, key: string, value: any) => any) | undefined): any} [reviver]
|
||||
* @returns {any}
|
||||
*/
|
||||
var parse = function parse(text, reviver) {
|
||||
var input = $parse(text, Primitives).map(primitives);
|
||||
var value = input[0];
|
||||
@@ -80,6 +78,14 @@ self.Flatted = (function (exports) {
|
||||
'': tmp
|
||||
}, '', tmp);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a JS value into a specialized flatted string.
|
||||
* @param {any} value
|
||||
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
|
||||
* @param {string | number | undefined} [space]
|
||||
* @returns {string}
|
||||
*/
|
||||
var stringify = function stringify(value, replacer, space) {
|
||||
var $ = replacer && _typeof(replacer) === object ? function (k, v) {
|
||||
return k === '' || -1 < replacer.indexOf(k) ? v : void 0;
|
||||
@@ -91,38 +97,43 @@ self.Flatted = (function (exports) {
|
||||
'': value
|
||||
}, '', value));
|
||||
var firstRun = !i;
|
||||
|
||||
while (i < input.length) {
|
||||
firstRun = true;
|
||||
output[i] = $stringify(input[i++], replace, space);
|
||||
}
|
||||
|
||||
return '[' + output.join(',') + ']';
|
||||
|
||||
function replace(key, value) {
|
||||
if (firstRun) {
|
||||
firstRun = !firstRun;
|
||||
return value;
|
||||
}
|
||||
|
||||
var after = $.call(this, key, value);
|
||||
|
||||
switch (_typeof(after)) {
|
||||
case object:
|
||||
if (after === null) return after;
|
||||
|
||||
case primitive:
|
||||
return known.get(after) || set(known, input, after);
|
||||
}
|
||||
|
||||
return after;
|
||||
}
|
||||
};
|
||||
var toJSON = function toJSON(any) {
|
||||
return $parse(stringify(any));
|
||||
|
||||
/**
|
||||
* Converts a generic value into a JSON serializable object without losing recursion.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
var toJSON = function toJSON(value) {
|
||||
return $parse(stringify(value));
|
||||
};
|
||||
var fromJSON = function fromJSON(any) {
|
||||
return parse($stringify(any));
|
||||
|
||||
/**
|
||||
* Converts a previously serialized object with recursion into a recursive one.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
var fromJSON = function fromJSON(value) {
|
||||
return parse($stringify(value));
|
||||
};
|
||||
|
||||
exports.fromJSON = fromJSON;
|
||||
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
self.Flatted=function(n){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)
|
||||
/*! (c) 2020 Andrea Giammarchi */}var r=JSON.parse,e=JSON.stringify,o=Object.keys,u=String,f="string",i={},c="object",a=function(n,t){return t},l=function(n){return n instanceof u?u(n):n},s=function(n,r){return t(r)===f?new u(r):r},y=function n(r,e,f,a){for(var l=[],s=o(f),y=s.length,p=0;p<y;p++){var v=s[p],S=f[v];if(S instanceof u){var b=r[S];t(b)!==c||e.has(b)?f[v]=a.call(f,v,b):(e.add(b),f[v]=i,l.push({k:v,a:[r,e,b,a]}))}else f[v]!==i&&(f[v]=a.call(f,v,S))}for(var m=l.length,g=0;g<m;g++){var h=l[g],O=h.k,d=h.a;f[O]=a.call(f,O,n.apply(null,d))}return f},p=function(n,t,r){var e=u(t.push(r)-1);return n.set(r,e),e},v=function(n,e){var o=r(n,s).map(l),u=o[0],f=e||a,i=t(u)===c&&u?y(o,new Set,u,f):u;return f.call({"":i},"",i)},S=function(n,r,o){for(var u=r&&t(r)===c?function(n,t){return""===n||-1<r.indexOf(n)?t:void 0}:r||a,i=new Map,l=[],s=[],y=+p(i,l,u.call({"":n},"",n)),v=!y;y<l.length;)v=!0,s[y]=e(l[y++],S,o);return"["+s.join(",")+"]";function S(n,r){if(v)return v=!v,r;var e=u.call(this,n,r);switch(t(e)){case c:if(null===e)return e;case f:return i.get(e)||p(i,l,e)}return e}};return n.fromJSON=function(n){return v(e(n))},n.parse=v,n.stringify=S,n.toJSON=function(n){return r(S(n))},n}({});
|
||||
self.Flatted=function(n){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)}var r=JSON.parse,e=JSON.stringify,o=Object.keys,u=String,f="string",i={},c="object",a=function(n,t){return t},l=function(n){return n instanceof u?u(n):n},s=function(n,r){return t(r)===f?new u(r):r},y=function n(r,e,f,a){for(var l=[],s=o(f),y=s.length,p=0;p<y;p++){var v=s[p],S=f[v];if(S instanceof u){var b=r[S];t(b)!==c||e.has(b)?f[v]=a.call(f,v,b):(e.add(b),f[v]=i,l.push({k:v,a:[r,e,b,a]}))}else f[v]!==i&&(f[v]=a.call(f,v,S))}for(var m=l.length,g=0;g<m;g++){var h=l[g],O=h.k,d=h.a;f[O]=a.call(f,O,n.apply(null,d))}return f},p=function(n,t,r){var e=u(t.push(r)-1);return n.set(r,e),e},v=function(n,e){var o=r(n,s).map(l),u=o[0],f=e||a,i=t(u)===c&&u?y(o,new Set,u,f):u;return f.call({"":i},"",i)},S=function(n,r,o){for(var u=r&&t(r)===c?function(n,t){return""===n||-1<r.indexOf(n)?t:void 0}:r||a,i=new Map,l=[],s=[],y=+p(i,l,u.call({"":n},"",n)),v=!y;y<l.length;)v=!0,s[y]=e(l[y++],S,o);return"["+s.join(",")+"]";function S(n,r){if(v)return v=!v,r;var e=u.call(this,n,r);switch(t(e)){case c:if(null===e)return e;case f:return i.get(e)||p(i,l,e)}return e}};return n.fromJSON=function(n){return v(e(n))},n.parse=v,n.stringify=S,n.toJSON=function(n){return r(S(n))},n}({});
|
||||
+16
-14
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "flatted",
|
||||
"version": "3.2.7",
|
||||
"version": "3.3.1",
|
||||
"description": "A super light and fast circular JSON parser.",
|
||||
"unpkg": "min.js",
|
||||
"types": "types.d.ts",
|
||||
"main": "./cjs/index.js",
|
||||
"scripts": {
|
||||
"build": "npm run cjs && npm run rollup:esm && npm run rollup:es && npm run rollup:babel && npm run min && npm run test && npm run size",
|
||||
@@ -15,6 +14,8 @@
|
||||
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c;cat min.js | brotli | wc -c; cat es.js | brotli | wc -c; cat esm.js | brotli | wc -c",
|
||||
"test": "c8 node test/index.js",
|
||||
"test:php": "php php/test.php",
|
||||
"test:py": "python python/test.py",
|
||||
"ts": "tsc -p .",
|
||||
"coverage": "mkdir -p ./coverage; c8 report --reporter=text-lcov > ./coverage/lcov.info"
|
||||
},
|
||||
"repository": {
|
||||
@@ -35,29 +36,30 @@
|
||||
},
|
||||
"homepage": "https://github.com/WebReflection/flatted#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.10",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@ungap/structured-clone": "^1.0.1",
|
||||
"ascjs": "^5.0.1",
|
||||
"c8": "^7.12.0",
|
||||
"@babel/core": "^7.23.9",
|
||||
"@babel/preset-env": "^7.23.9",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@ungap/structured-clone": "^1.2.0",
|
||||
"ascjs": "^6.0.3",
|
||||
"c8": "^9.1.0",
|
||||
"circular-json": "^0.5.9",
|
||||
"circular-json-es6": "^2.0.2",
|
||||
"jsan": "^3.1.14",
|
||||
"rollup": "^2.78.1",
|
||||
"rollup-plugin-babel": "^4.4.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"terser": "^5.14.2"
|
||||
"rollup": "^4.12.0",
|
||||
"terser": "^5.27.2",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"module": "./esm/index.js",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./types.d.ts",
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./esm/index.js",
|
||||
"default": "./cjs/index.js"
|
||||
},
|
||||
"./esm": "./esm.js",
|
||||
"./package.json": "./package.json"
|
||||
}
|
||||
},
|
||||
"types": "./types/index.d.ts"
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
class FlattedString {
|
||||
public $value = '';
|
||||
public function __construct($value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
@@ -148,7 +149,6 @@ class Flatted {
|
||||
foreach ($keys as $key) {
|
||||
$value->$key = self::wrap($value->$key);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
interface Flatted {
|
||||
/**
|
||||
* Converts a JavaScript Object Notation (using Flatted encoding) string into an object.
|
||||
* @param text A valid Flatted string.
|
||||
* @param reviver A function that transforms the results. This function is called for each member of the object.
|
||||
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
||||
*/
|
||||
parse(
|
||||
text: string,
|
||||
reviver?: (this: any, key: string, value: any) => any
|
||||
): any;
|
||||
/**
|
||||
* Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
|
||||
* @param value A JavaScript value, usually an object or array, to be converted.
|
||||
* @param replacer A function that transforms the results.
|
||||
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
||||
*/
|
||||
stringify(
|
||||
value: any,
|
||||
replacer?: (this: any, key: string, value: any) => any,
|
||||
space?: string | number
|
||||
): string;
|
||||
/**
|
||||
* Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
|
||||
* @param value A JavaScript value, usually an object or array, to be converted.
|
||||
* @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
|
||||
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
||||
*/
|
||||
stringify(
|
||||
value: any,
|
||||
replacer?: (number | string)[] | null,
|
||||
space?: string | number
|
||||
): string;
|
||||
/**
|
||||
* Helper to allow explicit conversions with classes.
|
||||
* @param value The JSON to convert to JavaScript value
|
||||
*/
|
||||
fromJSON(value: any): any;
|
||||
/**
|
||||
* Helper to allow explicit conversions with classes.
|
||||
* @param value A JavaScript value, usually an object or array, to be converted.
|
||||
*/
|
||||
toJSON(value: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast and minimal circular JSON parser.
|
||||
* logic example
|
||||
```js
|
||||
var a = [{one: 1}, {two: '2'}];
|
||||
a[0].a = a;
|
||||
// a is the main object, will be at index '0'
|
||||
// {one: 1} is the second object, index '1'
|
||||
// {two: '2'} the third, in '2', and it has a string
|
||||
// which will be found at index '3'
|
||||
Flatted.stringify(a);
|
||||
// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
|
||||
// a[one,two] {one: 1, a} {two: '2'} '2'
|
||||
```
|
||||
*/
|
||||
declare const Flatted: Flatted;
|
||||
export = Flatted;
|
||||
Reference in New Issue
Block a user