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

Method delete

lib/commands/pkg.js:105–124  ·  view source on GitHub ↗
(args, { path })

Source from the content-addressed store, hash-verified

103 }
104
105 async delete (args, { path }) {
106 const setError = () =>
107 this.usageError('npm pkg delete expects key args.')
108
109 if (!args.length) {
110 throw setError()
111 }
112
113 const pkgJson = await PackageJson.load(path)
114 const q = new Queryable(pkgJson.content)
115 for (const key of args) {
116 if (!key) {
117 throw setError()
118 }
119
120 q.delete(key)
121 }
122
123 return pkgJson.update(q.toJSON())
124 }
125}
126
127module.exports = Pkg

Callers 15

execMethod · 0.95
execMethod · 0.45
execMethod · 0.45
setMethod · 0.45
delMethod · 0.45
execMethod · 0.45
queryable.jsFile · 0.45
unpublish.jsFile · 0.45
reject.jsFile · 0.45
removePermissionsMethod · 0.45
logoutMethod · 0.45
unpublishMethod · 0.45

Calls 4

deleteMethod · 0.95
toJSONMethod · 0.95
updateMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected