1export function recursivelyCalculateRelations(node, parentChain = []) { 2 const allParents = [...parentChain] 3 const descendants = [] 4 5 // Recursively calculate relations for children 6 if (node.children && node.children.length > 0) { 7 node.children.forEach((child) => { 8 const childNode = recursivelyCalculateRelations(child, [node, ...allParents]) 9 descendants.push(child, ...childNode.descendants) 10 }) 11 } 12 13 node.parent = allParents[0] 14 node.parents = allParents 15 node.descendants = descendants 16 return node 17} 18 19// deepGet({ comment: { label: 'foo' }}, 'comment.label') => 'foo' 20export function deepGet(obj, path) { 21 if (obj === undefined) return undefined 22 if (typeof path === 'string') return deepGet(obj, path.split('.')) 23 if (path.length === 0) return obj 24 return deepGet(obj[path[0]], path.slice(1)) 25}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.