MCPcopy Create free account
hub / github.com/nodejs/node / packageName

Method packageName

deps/npm/lib/commands/diff.js:77–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75 // get the package name from the packument at `path`
76 // throws if no packument is present OR if it does not have `name` attribute
77 async packageName () {
78 let name
79 try {
80 const { content: pkg } = await pkgJson.normalize(this.prefix)
81 name = pkg.name
82 } catch {
83 log.verbose('diff', 'could not read project dir package.json')
84 }
85
86 if (!name) {
87 throw this.usageError('Needs multiple arguments to compare or run from a project dir.')
88 }
89
90 return name
91 }
92
93 async retrieveSpecs ([a, b]) {
94 if (a && b) {

Callers 1

retrieveSpecsMethod · 0.95

Calls 2

verboseMethod · 0.80
usageErrorMethod · 0.80

Tested by

no test coverage detected