Skip to content

Commit

Permalink
chore: remove unused spec parameter, assign error code
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Sep 17, 2020
1 parent 940e4a9 commit 5e780a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/utils/get-identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const npm = require('../npm')
const needsAuthError = (msg) =>
Object.assign(new Error(msg), { code: 'ENEEDAUTH' })

module.exports = async (opts = {}, spec = null) => {
module.exports = async (opts = {}) => {
const { registry } = opts
if (!registry) {
throw new Error('no default registry set')
throw Object.assign(new Error('No registry specified.'), { code: 'ENOREGISTRY' })
}

// First, check if we have a user/pass-based auth
Expand All @@ -20,8 +20,7 @@ module.exports = async (opts = {}, spec = null) => {
} else if (token) {
// No username, but we have a token; fetch the username from registry
const registryData = await npmFetch.json('/-/whoami', {
...opts,
spec
...opts
})
const { username: usernameFromRegistry } = registryData
// Retrieved username from registry; return it
Expand Down

0 comments on commit 5e780a5

Please sign in to comment.