This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new method `isDefault(key)` that enables a way to know if the value to be returned by a `config.get(key)` call is coming from the default definitions or any other different source. In case it's coming from the default values this method returns `true`, it returns `false` otherwise. This addition is going to allow for effectively managing different default values in the npm cli on a command-basis, e.g: The `save` config default value in the npm cli is `true`, so that in `npm install` and other commands that value is always going to default to true if no user config is provided. Now let's say we want to use a different value in `npm update`, for example `save=false`. This change enables us to have a conditional check to see if the `save` config value is coming from the default source, thus providing a way to use a different value instead of the default: const save = config.isDefault('save') ? false : config.get('save') Relates to: npm/cli#4223 Relates to: npm/statusboard#324
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters