add stringify formating for bigint

This commit is contained in:
2022-11-15 05:36:04 +01:00
parent accd3d2155
commit 01e49b7d38
3 changed files with 17 additions and 1 deletions

11
package-lock.json generated
View File

@@ -10,6 +10,7 @@
"dependencies": {
"@codemirror/lang-javascript": "^6.1.1",
"@codemirror/theme-one-dark": "^6.1.0",
"@gkucmierz/utils": "^1.12.1",
"codemirror": "^6.0.1",
"javascript-stringify": "^2.1.0",
"normalize.css": "^8.0.1",
@@ -1869,6 +1870,11 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/@gkucmierz/utils": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/@gkucmierz/utils/-/utils-1.12.1.tgz",
"integrity": "sha512-oP/4FMdP3h+fKh+Rpv3SB2F5K5DmOsMh4AuiKu8uWUtw1LkIy18JS7qzcKH0258iBg/zhXvhgcOI0LGuffsUCA=="
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",
@@ -6841,6 +6847,11 @@
"strip-json-comments": "^3.1.1"
}
},
"@gkucmierz/utils": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/@gkucmierz/utils/-/utils-1.12.1.tgz",
"integrity": "sha512-oP/4FMdP3h+fKh+Rpv3SB2F5K5DmOsMh4AuiKu8uWUtw1LkIy18JS7qzcKH0258iBg/zhXvhgcOI0LGuffsUCA=="
},
"@humanwhocodes/config-array": {
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",

View File

@@ -10,6 +10,7 @@
"dependencies": {
"@codemirror/lang-javascript": "^6.1.1",
"@codemirror/theme-one-dark": "^6.1.0",
"@gkucmierz/utils": "^1.12.1",
"codemirror": "^6.0.1",
"javascript-stringify": "^2.1.0",
"normalize.css": "^8.0.1",

View File

@@ -1,6 +1,7 @@
import { stringify } from 'javascript-stringify';
import { MAX_DATA_SIZE } from './app.config';
import { getType } from '@gkucmierz/utils/src/get-type';
const log = console.log;
console.log = (...a) => l(a);
@@ -46,7 +47,10 @@ const throttledPM = (() => {
})();
const l = args => {
const data = args.map(el => stringify(el, null, ' ')).join(', ');
const data = args.map(el => stringify(el, (val, ind, str) => {
if (getType(val) === 'bigint') return `${val}n`;
return val;
}, ' ')).join(', ');
throttledPM(data);
};