heapsnapshot
Advanced tools
+1
-1
@@ -21,4 +21,4 @@ 'use strict'; | ||
| toString() { | ||
| return `<edge:${this.name_or_index} from: ${from.toStringContent()} to ${to.toStringContent()}>`; | ||
| return `<edge: ${this.name_or_index} from(${this.from.toStringContent()}) to(${this.to.toStringContent()})>`; | ||
| } | ||
| } |
@@ -72,2 +72,6 @@ 'use strict'; | ||
| buildSync() { | ||
| for (let _ of this.build()) { } | ||
| } | ||
| * build() { | ||
@@ -74,0 +78,0 @@ let index = 0; |
+2
-1
@@ -31,4 +31,5 @@ 'use strict'; | ||
| toStringContent() { | ||
| return `${this.name || '(unknown node)'}:${this.index}` | ||
| return `${this.name || '(unknown node)'}: ${this.index}` | ||
| } | ||
| toString() { | ||
@@ -35,0 +36,0 @@ return `<${this.toStringContent()}>` |
| 'use strict'; | ||
| module.exports = function pathToRoot(node, visited = new WeakSet(), fromEdge) { | ||
| module.exports = function pathToRoot(node) { | ||
| let visited = arguments[1] || new WeakSet(); | ||
| let fromEdge = arguments[2]; | ||
| if (visited.has(node)) { return; } | ||
@@ -18,2 +20,4 @@ visited.add(node); | ||
| } | ||
| return []; | ||
| }; |
+9
-2
| { | ||
| "name": "heapsnapshot", | ||
| "version": "0.0.3", | ||
| "version": "0.0.4", | ||
| "main": "index.js", | ||
| "license": "MIT", | ||
| "repository": "https://github.com/stefanpenner/heapsnapshot.git", | ||
| "scripts": { | ||
| "test": "mocha tests" | ||
| }, | ||
| "files": [ | ||
| "index.js", | ||
| "lib" | ||
| ] | ||
| ], | ||
| "devDependencies": { | ||
| "chai": "^4.0.2", | ||
| "mocha": "^3.4.2" | ||
| } | ||
| } |
+26
-3
| # heapsnapshot | ||
| [](https://travis-ci.org/stefanpenner/heapsnapshot) | ||
| A Programmatic API for a heapsnapshot. | ||
| Currently supports dumps from: | ||
| * chrome/v8 | ||
| usage: | ||
| * `yarn add heapsnapshot` | ||
| * `npm install heapsnapshot` | ||
| ```js | ||
@@ -15,3 +19,3 @@ | ||
| // TODO: iterate for building (so we can do it eventually incrementally) | ||
| for (let _ of snapshot.build()) { } | ||
| snapshot.buildSync(); // alternatively build() is a generator, which allows for incremental building. | ||
@@ -26,1 +30,20 @@ // get all nodes | ||
| ``` | ||
| ### Stuff | ||
| #### Node | ||
| ```js | ||
| node.in // => array in in-bound edges | ||
| node.out // => array in in-bound edges | ||
| node.toString() // => "<Container: 622248>" | ||
| ``` | ||
| #### Edge | ||
| ```js | ||
| edge.to // => node the edge points to | ||
| edge.from // => node the edge comes from | ||
| edge.toString() // => "<name: from(Container: 622248) to ((map descriptors): 625980)" | ||
| ``` |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
9450
10.15%233
2.64%48
92%2
Infinity%