defaults
npmv3.0.0TypeScriptEasily handle defaults for your options
Adopt with care
defaults is usable, with caveats. Last published 1057 days ago.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- DMaintenance: grade D, Poor — a real concern.
Last published 1057 days ago.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 5.5 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding defaults to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Compatibility
- Node.js
- node >=18
- Module format
- ESM only
- TypeScript
- Types included
- Install scripts
- None
Quick start
A usage example from the defaults README.
import defaults from 'defaults';
const calculate = options => {
options = defaults(options, {
timeout: {
before: 100,
after: 100
}
});
console.log(options);
//=> {timeout: {before: 200, after: 100}}
// …defaults vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| defaultsthis page | 0 | 1 | MIT | 2 years ago |
| merge-descriptors | 113M | 1 | MIT | 1 day ago |
| rfdc | 46.8M | 3 | MIT | 1 day ago |
| @eslint/object-schema | 0 | 1 | Apache-2.0 | 1 day ago |
| define-lazy-prop | 0 | 1 | MIT | 1 day ago |
| deepmerge | 0 | 5 | MIT | 1 day ago |
Dependencies
Declared by defaults v3.0.0. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (3)
Used by
Popular packages that depend on defaults.
Relationship graph
Dependencies (left) and dependents (right) of defaults.
Release history
No releases in the last two years, typically about 183 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 3.0.0latest | 2 years ago | 5.5 KB | MIT |
| 2.0.2 | 3 years ago | 5.4 KB | MIT |
| 2.0.1 | 3 years ago | 5.4 KB | MIT |
| 2.0.0 | 3 years ago | 5.3 KB | MIT |
| 1.0.4 | 3 years ago | 3.8 KB | MIT |
| 1.0.3 | 11 years ago | — | MIT |
| 1.0.2 | 11 years ago | — | MIT |
| 1.0.1 | 11 years ago | — | MIT |
| 1.0.0 | 13 years ago | — | MIT |
Overview
defaults is an npm package that easily handle defaults for your options. It has 1 known dependents in the graph. The latest version is 3.0.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need easily handle defaults for your options and value a focused solution.
When not to use it
Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.
Pros
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
- Lean dependency tree (3 direct dependencies).
Cons
- No significant drawbacks detected from available metadata.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Funding
Frequently asked questions
Should I use defaults?
defaults is usable, with caveats. Last published 1057 days ago.
How do I install defaults?
Run `npm install defaults` to add defaults to your npm project.
What license is defaults released under?
defaults is distributed under the MIT license.
How popular is defaults?
npm does not publish download counts. Within PackageGraph's crawl, 1 known packages depend on defaults.
Is defaults still maintained?
The most recent release of defaults (v3.0.0) was published 2 years ago.
Does defaults run install scripts?
No. defaults does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.