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

Method delete

deps/npm/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 1

execMethod · 0.95

Calls 5

deleteMethod · 0.95
toJSONMethod · 0.95
setErrorFunction · 0.85
updateMethod · 0.65
loadMethod · 0.45

Tested by

no test coverage detected