From 92ec0dacb20af1b32ae5f07cf59440ade21b25e7 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 10 Oct 2023 09:11:10 -0700 Subject: [PATCH] feat: add getAuth to main exports the npm cli uses this so it would be nice to formalize this export --- lib/index.js | 2 ++ test/auth.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/index.js b/lib/index.js index 23e349c5..bb413f86 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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()) diff --git a/test/auth.js b/test/auth.js index 1d786bec..5e88f312 100644 --- a/test/auth.js +++ b/test/auth.js @@ -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) +})