Skip to content

Commit

Permalink
fixup revert stringifyWithBigint
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 15, 2024
1 parent 027f04f commit 07e5c5a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
24 changes: 0 additions & 24 deletions packages/internal/src/js-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,3 @@ export const makeMeasureSeconds = currentTimeMillisec => {
};
return measureSeconds;
};

/**
* @param {CopyRecord | Primitive} obj
* @returns {string}
*/
export const stringifyWithBigint = obj =>
JSON.stringify(obj, (key, value) => {
return typeof value === 'bigint' ? value.toString() : value;
});

/** @type {(str: string) => boolean} */
const isOnlyNumbers = str => /^\d+$/.test(str);

/**
* @param {string} str
* @returns unknown
*/
export const parseWithBigint = str =>
JSON.parse(str, (key, value) => {
if (typeof value === 'string' && isOnlyNumbers(value)) {
return BigInt(value);
}
return value;
});
2 changes: 0 additions & 2 deletions packages/internal/test/snapshots/exports.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ Generated by [AVA](https://avajs.dev).
'mustMatch',
'objectMap',
'objectMetaMap',
'parseWithBigint',
'serializePureData',
'slotToBoardRemote',
'stringifyWithBigint',
'synchronizedTee',
'unmarshalFromVstorage',
'unserializePureData',
Expand Down
Binary file modified packages/internal/test/snapshots/exports.test.js.snap
Binary file not shown.

0 comments on commit 07e5c5a

Please sign in to comment.