MCPcopy Create free account
hub / github.com/npm/cli / formatNode

Function formatNode

workspaces/arborist/test/diff.js:13–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11const normalizePath = path => path.replace(/^\w:/, '').replace(/\\/g, '/')
12const normalizedCWD = normalizePath(process.cwd())
13const formatNode = node =>
14 node && Object.assign(Object.create(node.constructor.prototype), {
15 name: node.name,
16 path: normalizePath(node.path).split(normalizedCWD).join('{CWD}'),
17 integrity: node.integrity,
18 })
19
20const { format } = require('tcompare')
21

Callers 1

formatDiffFunction · 0.85

Calls 2

normalizePathFunction · 0.70
createMethod · 0.45

Tested by

no test coverage detected