Skip to content

Commit 01adf42

Browse files
committed
bug: Fixed email address and homepage
refactor: Updated devDependencies feat: Added max depth
1 parent 320839e commit 01adf42

17 files changed

+267
-162
lines changed

__tests__/typedStringify.test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import BigNumber from 'bignumber.js';
22
import { cloneDeep, isEqual } from 'lodash';
3+
import { inspect } from 'node:util';
34
import { CustomParse, CustomStringify, parse, stringify, StringifyType, TypedValue } from '../src/index';
45

56
type TestType = StringifyType | 'BigNumber' | 'Buffer';
@@ -220,3 +221,15 @@ test('RangeError', () => {
220221
const error = new Error('error message');
221222
expect(isEqual(error, parse(stringify(error)))).toBe(true);
222223
});
224+
225+
test('stringify depth', () => {
226+
const obj = { '1': { '2': { '3': { '4': { '5': { '6': { '7': { '8': 'hello' } } } } } } } };
227+
expect(() => parse(stringify(obj, { maxDepth: 7 }))).toThrow(Error);
228+
expect(isEqual(obj, parse(stringify(obj, { maxDepth: 8 })))).toBe(true);
229+
});
230+
231+
test('parse depth', () => {
232+
const obj = { '1': { '2': { '3': { '4': { '5': { '6': { '7': { '8': 'hello' } } } } } } } };
233+
expect(() => parse(stringify(obj), { maxDepth: 7 })).toThrow(Error);
234+
expect(isEqual(obj, parse(stringify(obj), { maxDepth: 8 }))).toBe(true);
235+
});

dist/cjs/parse.js

+14-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/parse.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/stringify.js

+18-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)