Commit cc19d08
util: add (typed) array length to the default output
Align the inspect output with the one used in the Chrome dev tools.
A recent survey outlined that most users prefer to see the number
of set and map entries. This should count as well for array sizes.
The size is only added to regular arrays in case the constructor is
not the default constructor.
Typed arrays always indicate their size.
Backport-PR-URL: #31431
PR-URL: #31027
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>1 parent 3b9360d commit cc19d08Copy full SHA for cc19d08
File tree
Expand file treeCollapse file tree
6 files changed
+69
-73
lines changedOpen diff view settings
Filter options
- lib/internal/util
- test/parallel
Expand file treeCollapse file tree
6 files changed
+69
-73
lines changedOpen diff view settings
Collapse file
lib/internal/util/inspect.js
Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js+25-32Lines changed: 25 additions & 32 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
119 | 119 | |
120 | 120 | |
121 | 121 | |
| 122 | + |
| 123 | + |
| 124 | + |
122 | 125 | |
123 | 126 | |
124 | 127 | |
| ||
564 | 567 | |
565 | 568 | |
566 | 569 | |
567 | | - |
| 570 | + |
568 | 571 | |
569 | 572 | |
570 | | - |
| 573 | + |
571 | 574 | |
572 | | - |
| 575 | + |
573 | 576 | |
574 | 577 | |
575 | 578 | |
576 | | - |
| 579 | + |
577 | 580 | |
578 | | - |
| 581 | + |
579 | 582 | |
580 | 583 | |
581 | 584 | |
| ||
760 | 763 | |
761 | 764 | |
762 | 765 | |
763 | | - |
764 | 766 | |
765 | | - |
766 | | - |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
| 771 | + |
767 | 772 | |
768 | 773 | |
769 | 774 | |
770 | 775 | |
771 | 776 | |
772 | 777 | |
| 778 | + |
773 | 779 | |
774 | | - |
775 | | - |
776 | | - |
777 | | - |
778 | | - |
779 | | - |
780 | | - |
781 | | - |
782 | | - |
783 | | - |
| 780 | + |
| 781 | + |
| 782 | + |
784 | 783 | |
785 | 784 | |
786 | 785 | |
787 | 786 | |
788 | 787 | |
| 788 | + |
789 | 789 | |
790 | | - |
791 | | - |
792 | | - |
793 | | - |
794 | | - |
795 | | - |
796 | | - |
797 | | - |
798 | | - |
799 | | - |
| 790 | + |
| 791 | + |
| 792 | + |
800 | 793 | |
801 | 794 | |
802 | 795 | |
803 | 796 | |
804 | 797 | |
805 | 798 | |
806 | | - |
| 799 | + |
807 | 800 | |
808 | 801 | |
809 | | - |
| 802 | + |
810 | 803 | |
811 | 804 | |
812 | | - |
813 | | - |
814 | 805 | |
| 806 | + |
| 807 | + |
815 | 808 | |
816 | 809 | |
817 | 810 | |
|
Collapse file
test/parallel/test-assert-deep.js
Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | | - |
55 | | - |
| 54 | + |
| 55 | + |
56 | 56 | |
57 | 57 | |
58 | 58 | |
| ||
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | | - |
| 69 | + |
70 | 70 | |
71 | 71 | |
72 | 72 | |
| ||
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | | - |
| 89 | + |
90 | 90 | |
91 | 91 | |
92 | 92 | |
|
Collapse file
test/parallel/test-buffer-inspect.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-inspect.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | | - |
| 61 | + |
62 | 62 | |
63 | 63 | |
64 | 64 | |
|
Collapse file
test/parallel/test-fs-read-empty-buffer.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-read-empty-buffer.js+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | | - |
| 18 | + |
19 | 19 | |
20 | 20 | |
21 | 21 | |
| ||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | | - |
| 27 | + |
28 | 28 | |
29 | 29 | |
30 | 30 | |
| ||
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | | - |
| 38 | + |
39 | 39 | |
40 | 40 | |
41 | 41 | |
Collapse file
test/parallel/test-util-format.js
Copy file name to clipboardExpand all lines: test/parallel/test-util-format.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
158 | 158 | |
159 | 159 | |
160 | 160 | |
161 | | - |
| 161 | + |
162 | 162 | |
163 | 163 | |
164 | 164 | |
|
Collapse file
test/parallel/test-util-inspect.js
Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js+35-32Lines changed: 35 additions & 32 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | | - |
| 129 | + |
130 | 130 | |
131 | 131 | |
132 | 132 | |
| ||
263 | 263 | |
264 | 264 | |
265 | 265 | |
266 | | - |
| 266 | + |
267 | 267 | |
268 | 268 | |
269 | 269 | |
| ||
273 | 273 | |
274 | 274 | |
275 | 275 | |
276 | | - |
| 276 | + |
277 | 277 | |
278 | 278 | |
279 | 279 | |
| ||
297 | 297 | |
298 | 298 | |
299 | 299 | |
300 | | - |
| 300 | + |
301 | 301 | |
302 | 302 | |
303 | 303 | |
| ||
307 | 307 | |
308 | 308 | |
309 | 309 | |
310 | | - |
| 310 | + |
311 | 311 | |
312 | 312 | |
313 | 313 | |
| ||
397 | 397 | |
398 | 398 | |
399 | 399 | |
400 | | - |
| 400 | + |
401 | 401 | |
402 | 402 | |
403 | 403 | |
404 | | - |
| 404 | + |
405 | 405 | |
406 | 406 | |
407 | 407 | |
| ||
1291 | 1291 | |
1292 | 1292 | |
1293 | 1293 | |
1294 | | - |
| 1294 | + |
1295 | 1295 | |
1296 | 1296 | |
1297 | 1297 | |
| ||
1387 | 1387 | |
1388 | 1388 | |
1389 | 1389 | |
1390 | | - |
| 1390 | + |
1391 | 1391 | |
1392 | 1392 | |
1393 | 1393 | |
| ||
1672 | 1672 | |
1673 | 1673 | |
1674 | 1674 | |
1675 | | - |
| 1675 | + |
1676 | 1676 | |
1677 | 1677 | |
1678 | 1678 | |
| ||
1689 | 1689 | |
1690 | 1690 | |
1691 | 1691 | |
1692 | | - |
| 1692 | + |
1693 | 1693 | |
1694 | 1694 | |
1695 | 1695 | |
| ||
1720 | 1720 | |
1721 | 1721 | |
1722 | 1722 | |
1723 | | - |
| 1723 | + |
1724 | 1724 | |
1725 | 1725 | |
1726 | 1726 | |
1727 | 1727 | |
1728 | 1728 | |
1729 | 1729 | |
1730 | 1730 | |
1731 | | - |
| 1731 | + |
1732 | 1732 | |
1733 | 1733 | |
1734 | 1734 | |
| ||
1756 | 1756 | |
1757 | 1757 | |
1758 | 1758 | |
1759 | | - |
| 1759 | + |
1760 | 1760 | |
1761 | 1761 | |
1762 | 1762 | |
| ||
1768 | 1768 | |
1769 | 1769 | |
1770 | 1770 | |
1771 | | - |
| 1771 | + |
1772 | 1772 | |
1773 | 1773 | |
1774 | 1774 | |
| ||
1946 | 1946 | |
1947 | 1947 | |
1948 | 1948 | |
1949 | | - |
| 1949 | + |
1950 | 1950 | |
1951 | 1951 | |
1952 | 1952 | |
| ||
1972 | 1972 | |
1973 | 1973 | |
1974 | 1974 | |
1975 | | - |
| 1975 | + |
1976 | 1976 | |
1977 | 1977 | |
1978 | 1978 | |
1979 | 1979 | |
1980 | 1980 | |
1981 | 1981 | |
1982 | | - |
1983 | | - |
1984 | | - |
1985 | | - |
1986 | | - |
1987 | | - |
1988 | | - |
1989 | | - |
1990 | | - |
1991 | | - |
| 1982 | + |
| 1983 | + |
| 1984 | + |
| 1985 | + |
| 1986 | + |
| 1987 | + |
| 1988 | + |
| 1989 | + |
| 1990 | + |
| 1991 | + |
1992 | 1992 | |
1993 | 1993 | |
1994 | 1994 | |
| ||
2026 | 2026 | |
2027 | 2027 | |
2028 | 2028 | |
2029 | | - |
2030 | | - |
| 2029 | + |
| 2030 | + |
| 2031 | + |
| 2032 | + |
2031 | 2033 | |
2032 | 2034 | |
2033 | 2035 | |
| ||
2050 | 2052 | |
2051 | 2053 | |
2052 | 2054 | |
2053 | | - |
2054 | | - |
| 2055 | + |
| 2056 | + |
| 2057 | + |
2055 | 2058 | |
2056 | 2059 | |
2057 | 2060 | |
| ||
2170 | 2173 | |
2171 | 2174 | |
2172 | 2175 | |
2173 | | - |
| 2176 | + |
2174 | 2177 | |
2175 | 2178 | |
2176 | 2179 | |
|
0 commit comments