Socket
Socket
Sign inDemoInstall

@npmcli/config

Package Overview
Dependencies
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@npmcli/config - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

14

lib/index.js

@@ -404,2 +404,16 @@ // TODO: set the scope config from package.json or explicit cli config

// Returns true if the value is coming directly from the source defined
// in default definitions, if the current value for the key config is
// coming from any other different source, returns false
isDefault (key) {
const [defaultType, ...types] = [...confTypes]
const defaultData = this.data.get(defaultType).data
return hasOwnProperty(defaultData, key)
&& types.every(type => {
const typeData = this.data.get(type).data
return !hasOwnProperty(typeData, key)
})
}
invalidHandler (k, val, type, source, where) {

@@ -406,0 +420,0 @@ this.log.warn(

2

package.json
{
"name": "@npmcli/config",
"version": "2.3.2",
"version": "2.4.0",
"files": [

@@ -5,0 +5,0 @@ "lib"

@@ -221,2 +221,25 @@ # `@npmcli/config`

### `config.isDefault(key)`
Returns `true` if the value is coming directly from the
default definitions, if the current value for the key config is
coming from any other source, returns `false`.
This method can be used for avoiding or tweaking default values, e.g:
> Given a global default definition of foo='foo' it's possible to read that
> value such as:
>
> ```js
> const save = config.get('foo')
> ```
>
> Now in a different place of your app it's possible to avoid using the `foo`
> default value, by checking to see if the current config value is currently
> one that was defined by the default definitions:
>
> ```js
> const save = config.isDefault('foo') ? 'bar' : config.get('foo')
> ```
### `config.save(where)`

@@ -223,0 +246,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc