(raw, fields, types, strings)
| 63 | } |
| 64 | |
| 65 | function readHeapInfo(raw, fields, types, strings) { |
| 66 | const items = []; |
| 67 | |
| 68 | for (let i = 0; i < raw.length; i += fields.length) { |
| 69 | const item = {}; |
| 70 | for (let j = 0; j < fields.length; j++) { |
| 71 | const name = fields[j]; |
| 72 | let type = types[j]; |
| 73 | if (Array.isArray(type)) { |
| 74 | item[name] = type[raw[i + j]]; |
| 75 | } else if (name === 'name_or_index') { // type === 'string_or_number' |
| 76 | if (item.type === 'element' || item.type === 'hidden') |
| 77 | type = 'number'; |
| 78 | else |
| 79 | type = 'string'; |
| 80 | } |
| 81 | |
| 82 | if (type === 'string') { |
| 83 | item[name] = strings[raw[i + j]]; |
| 84 | } else if (type === 'number' || type === 'node') { |
| 85 | item[name] = raw[i + j]; |
| 86 | } |
| 87 | } |
| 88 | items.push(item); |
| 89 | } |
| 90 | |
| 91 | return items; |
| 92 | } |
| 93 | |
| 94 | function inspectNode(snapshot) { |
| 95 | return util.inspect(snapshot, { depth: 4 }); |
no test coverage detected
searching dependent graphs…