diff options
Diffstat (limited to 'deps/npm/lib/deprecate.js')
-rw-r--r-- | deps/npm/lib/deprecate.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index e049986452b..42d099b544e 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -17,19 +17,17 @@ const usage = usageUtil( 'npm deprecate <pkg>[@<version>] <message>' ) -const completion = (opts, cb) => { +const completion = async (opts) => { if (opts.conf.argv.remain.length > 1) - return cb(null, []) + return [] - return getIdentity(npm.flatOptions).then((username) => { - return libaccess.lsPackages(username, npm.flatOptions).then((packages) => { - return Object.keys(packages) - .filter((name) => packages[name] === 'write' && - (opts.conf.argv.remain.length === 0 || - name.startsWith(opts.conf.argv.remain[0])) - ) - }) - }).then((list) => cb(null, list), (err) => cb(err)) + const username = await getIdentity(npm.flatOptions) + const packages = await libaccess.lsPackages(username, npm.flatOptions) + return Object.keys(packages) + .filter((name) => + packages[name] === 'write' && + (opts.conf.argv.remain.length === 0 || + name.startsWith(opts.conf.argv.remain[0]))) } const cmd = (args, cb) => |