4
4
[ ![ NPM] ( https://img.shields.io/npm/v/object-scan.svg )] ( https://www.npmjs.com/package/object-scan )
5
5
[ ![ Downloads] ( https://img.shields.io/npm/dt/object-scan.svg )] ( https://www.npmjs.com/package/object-scan )
6
6
[ ![ Size] ( https://shields.io/badge/min%20+%20gz-5.00%20KB-informational )] ( https://bundlephobia.com/package/object-scan )
7
- [ ![ Test Ratio] ( https://shields.io/badge/test%20:%20code-9.9 %20:%201-informational )] ( ./test/readme/replace-variables/ratio-badge.js )
7
+ [ ![ Test Ratio] ( https://shields.io/badge/test%20:%20code-9.8 %20:%201-informational )] ( ./test/readme/replace-variables/ratio-badge.js )
8
8
9
9
Traverse object hierarchies using matching and callbacks.
10
10
@@ -75,7 +75,8 @@ objectScan(['a.*.f'], { joined: true })(haystack);
75
75
<a href =" #81-traversal-order " ><img alt =" Traversal Order " src =" https://shields.io/badge/8.1.-Traversal%20Order-c96c01?style=flat-square " ></a ><br >
76
76
<a href =" #82-empty-string " ><img alt =" Empty String " src =" https://shields.io/badge/8.2.-Empty%20String-c96c01?style=flat-square " ></a ><br >
77
77
<a href =" #83-array-string-keys " ><img alt =" Array String Keys " src =" https://shields.io/badge/8.3.-Array%20String%20Keys-c96c01?style=flat-square " ></a ><br >
78
- <a href =" #84-internals " ><img alt =" Internals " src =" https://shields.io/badge/8.4.-Internals-c96c01?style=flat-square " ></a ></details >
78
+ <a href =" #84-sparse-arrays " ><img alt =" Sparse Arrays " src =" https://shields.io/badge/8.4.-Sparse%20Arrays-c96c01?style=flat-square " ></a ><br >
79
+ <a href =" #85-internals " ><img alt =" Internals " src =" https://shields.io/badge/8.5.-Internals-c96c01?style=flat-square " ></a ></details >
79
80
80
81
## 3. Features
81
82
@@ -1594,7 +1595,24 @@ objectScan(['**'], {
1594
1595
```
1595
1596
</details >
1596
1597
1597
- ### 8.4. Internals
1598
+ ### 8.4. Sparse Arrays
1599
+
1600
+ Only set keys are traversed for spare Arrays.
1601
+
1602
+ <details ><summary > <code >['**']</code > <em >(empty entries skipped)</em > </summary >
1603
+
1604
+ <!-- eslint-disable no-undef -->
1605
+ ``` js
1606
+ const haystack = (() => { const r = []; r[1 ] = ' a' ; return r; })();
1607
+ objectScan ([' **' ], {
1608
+ joined: true ,
1609
+ rtn: ' entry'
1610
+ })(haystack);
1611
+ // => [ [ '[1]', 'a' ] ]
1612
+ ```
1613
+ </details >
1614
+
1615
+ ### 8.5. Internals
1598
1616
1599
1617
This library has been designed around performance as a core feature.
1600
1618
@@ -1611,7 +1629,7 @@ Conceptually this package works as follows:
1611
1629
1612
1630
1 . During initialization the needles are parsed and built into a search tree.
1613
1631
Various information is pre-computed and stored for every node.
1614
- Finally the search function is returned.
1632
+ Finally, the search function is returned.
1615
1633
1616
1634
2 . When the search function is invoked, the input is traversed simultaneously with
1617
1635
the relevant nodes of the search tree. Processing multiple search tree branches
0 commit comments