MCPcopy
hub / github.com/posthtml/posthtml / traverse

Function traverse

lib/api.js:102–114  ·  view source on GitHub ↗

@private

(tree, cb)

Source from the content-addressed store, hash-verified

100
101/** @private */
102function traverse (tree, cb) {
103 if (Array.isArray(tree)) {
104 for (let i = 0; i < tree.length; i++) {
105 tree[i] = traverse(cb(tree[i]), cb)
106 }
107 } else if (
108 tree &&
109 typeof tree === 'object' &&
110 Object.prototype.hasOwnProperty.call(tree, 'content')
111 ) traverse(tree.content, cb)
112
113 return tree
114}
115
116/** @private */
117function compare (expected, actual) {

Callers 2

walkFunction · 0.85
matchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…