Skip to content

Commit

Permalink
feat: add getAuth to main exports
Browse files Browse the repository at this point in the history
the npm cli uses this so it would be nice to formalize this export
  • Loading branch information
wraithgar committed Oct 10, 2023
1 parent 54f46a4 commit 92ec0da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ function regFetch (uri, /* istanbul ignore next */ opts_ = {}) {
return Promise.resolve(body).then(doFetch)
}

module.exports.getAuth = getAuth

module.exports.json = fetchJSON
function fetchJSON (uri, opts) {
return regFetch(uri, opts).then(res => res.json())
Expand Down
4 changes: 4 additions & 0 deletions test/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,7 @@ t.test('registry host matches, path does not, send auth', t => {
})
t.end()
})

t.test('getAuth is exported', async t => {
t.equal(fetch.getAuth, getAuth)
})

0 comments on commit 92ec0da

Please sign in to comment.