Installations
npm install resolve-options
Developer
gulpjs
Developer Guide
Module System
CommonJS
Min. Node Version
>= 10.13.0
Typescript Support
No
Node Version
16.14.2
NPM Version
8.11.0
Statistics
9 Stars
15 Commits
7 Forks
5 Watching
1 Branches
4 Contributors
Updated on 10 Dec 2023
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
390,965,366
Last day
-5.4%
380,703
Compared to previous day
Last week
4.8%
2,065,934
Compared to previous week
Last month
19.3%
8,154,507
Compared to previous month
Last year
13.1%
87,225,481
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
6
resolve-options
Resolve an options object based on configuration.
Usage
1// This example assumes a Vinyl file 2 3var createResolver = require('resolve-options'); 4 5var config = { 6 cwd: { 7 type: 'string', 8 default: process.cwd, 9 }, 10 sourcemaps: { 11 type: 'boolean', 12 default: false, 13 }, 14 since: { 15 type: ['date', 'number'], 16 }, 17 read: { 18 type: 'boolean', 19 }, 20}; 21 22var options = { 23 sourcemaps: true, 24 since: Date.now(), 25 read: function (file) { 26 return file.extname !== '.mp4'; 27 }, 28}; 29 30var resolver = createResolver(config, options); 31 32var cwd = resolver.resolve('cwd', file); 33// cwd === process.cwd() 34 35var sourcemaps = resolver.resolve('sourcemaps', file); 36// sourcemaps === true 37 38var read = resolver.resolve('read', file); 39// Given .mp4, read === false 40// Given .txt, read === true
API
createResolver([config,] [options])
Takes a config
object that describes the options to accept/resolve and an options
object (usually passed by a user) to resolve against the config
. Returns a resolver
that contains a resolve
method for realtime resolution of options.
The config
object takes the following structure:
1config { 2 [optionKey] { 3 type // string, array or function 4 default // any value or function 5 } 6}
Each option is represented by its optionKey
in the config
object. It must be an object with a type
property.
The type
property must be a string, array or function which will be passed to the value-or-function
module (functions will be bound to the resolver to allow for dependent options).
A default
property may also be specified as a fallback if the option isn't available or is invalid. The default
value can be any value or a function (functions will be bound to the resolver to allow for dependent defaults). Note: default
values are not type-validated by the value-or-function
module.
resolver.resolve(optionKey, [...arguments])
Takes an optionKey
string and any number of arguments
to apply if an option is a function. Returns the resolved value for the optionKey
.
resolver.resolveConstant(optionKey)
Like resolve
, but only returns a value if the option is constant (not a function).
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/gulpjs/.github/SECURITY.md:1
- Info: Found linked content: github.com/gulpjs/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/gulpjs/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/gulpjs/.github/SECURITY.md:1
Reason
Found 4/14 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/dev.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/dev.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/dev.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/dev.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/dev.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/dev.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/dev.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/gulpjs/resolve-options/release.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/dev.yml:51
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/dev.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More