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

Method inNodeModules

workspaces/arborist/lib/node.js:1590–1599  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1588 }
1589
1590 inNodeModules () {
1591 const rp = this.realpath
1592 const name = this.name
1593 const scoped = name.charAt(0) === '@'
1594 const d = dirname(rp)
1595 const nm = scoped ? dirname(d) : d
1596 const dir = dirname(nm)
1597 const base = scoped ? `${basename(d)}/${basename(rp)}` : basename(rp)
1598 return base === name && basename(nm) === 'node_modules' ? dir : false
1599 }
1600
1601 // maybe accept both string value or array of strings
1602 // seems to be what dom API does

Callers 1

node.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected