-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better formatting for sparse arrays (#20379)
Right now arrays preview yields all array elements. In case of a sparse array with a single element on index 10000000, this results in a large string that OOM Node.js. This patch changes pretty-printing. For example: ```ts // Given this array const a = []; a[10] = 1; // Before this patch, pretty printing will yield: "[,,,,,,,,1]" // With this patch, pretty printing yields: "[empty x 9, 1]" ``` The new array pretty-printing is equal to what Chrome DevTools do to render sparse arrays. Fixes #20347
- Loading branch information
1 parent
5b93c1d
commit 9ca9b08
Showing
5 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters