Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

pnpm/credentials-by-uri

Repository files navigation

credentials-by-uri

npm version Status

Gets credentials for URI from npm configs

Install

pnpm add credentials-by-uri

Usage

const credentialsByUri = require('credentials-by-uri')

const config = {
  registry: 'https://registry.npmjs.com',
  '//registry.com/:_authToken': 'f23jj93f32dsaf==',
  '//registry.com/:always-auth': 'false'
}

console.log(
  credentialsByUri(config, 'https://registry.com')
)
> { authHeaderValue: 'Bearer f23jj93f32dsaf==', alwaysAuth: false }

Related

License

MIT