-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I noticed that maximumBreadth behaves correctly for objects, but not for arrays.
For objects, everything works as expected:
const stringify = configure({ maximumBreadth: 2 });
stringify({ 1:1, 2:2, 3:3 });
// ✅ '{"1":1,"2":2,"...":"1 item not stringified"}'But with arrays, the behavior is inconsistent:
const stringify = configure({ maximumBreadth: 2 });
stringify([1, 2]);
// ✅ '[1,2]'
stringify([1, 2, 3]);
// ❌ '[1,2]'
// - missing info that 1 item was not stringified
stringify([1, 2, 3, 4]);
// ❌ '[1,2,"... 1 item not stringified"]'
// - count is wrong (should be `"… 2 items not stringified"`)This results in missing information and an incorrect ellipsis element.
I made a PR with a fix:
Let me know if you want adjustments or extra tests.
Metadata
Metadata
Assignees
Labels
No labels