once
npmv1.4.0Run a function exactly one time
Not recommended for new projects
No — once should not be adopted for new projects. Last published 3655 days ago.
- AAdoption: grade A, Excellent.
109.6M downloads per week and 1 known dependents.
- FMaintenance: grade F, Failing.
Last published 3655 days ago.
- AWeight: grade A, Excellent.
Pulls in 1 transitive package.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
ISC — 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 once 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.
Licenses in the dependency tree
Every license you inherit by installing once, not just its own. Check this before a legal review, not after.
Compatibility
- Node.js
- No constraint declared
- Module format
- CommonJS only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the once README.
var once = require('once')
function load (file, cb) {
cb = once(cb)
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}once 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 |
|---|---|---|---|---|
| oncethis page | 109.6M | 1 | ISC | 10 years ago |
| callsites | 136.7M | 1 | MIT | 1 day ago |
| reusify | 91M | 1 | MIT | 1 day ago |
| call-bind | 80.7M | 5 | MIT | 1 day ago |
| generate-function | 12M | 1 | MIT | 1 day ago |
| split-on-first | 9.7M | 1 | MIT | 1 day ago |
Dependencies
Declared by once v1.4.0. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (1)
Dev (1)
Used by
Popular packages that depend on once.
Relationship graph
Dependencies (left) and dependents (right) of once.
Frequently installed together
Create and parse HTTP Content-Type header
The ultimate javascript content-type utility.
Create HTTP error objects
An AST-based pattern checker for JavaScript.
Encode a URL to a percent-encoded form, excluding already-encoded sequences
Node.js final http responder
Infer the content-type of a request.
Better streaming static file server with Range and conditional-GET support
Merge objects using their property descriptors
Deprecate all the things
Manipulate the HTTP Vary header
Create simple HTTP ETags
Release history
No releases in the last two years, typically about 291 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 1.4.0latest | 10 years ago | — | ISC |
| 1.3.3 | 10 years ago | — | ISC |
| 1.3.2 | 11 years ago | — | ISC |
| 1.3.1 | 12 years ago | — | BSD |
| 1.3.0 | 13 years ago | — | BSD |
| 1.2.0 | 13 years ago | — | BSD |
| 1.1.1 | 14 years ago | — | BSD |
Overview
once is an npm package that run a function exactly one time. It is extremely widely used, with about 109.6M downloads per week and 1 known dependents in the graph. The latest version is 1.4.0, released under the ISC license.
Who should use it
Teams working in the npm ecosystem who need run a function exactly one time and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (109.6M weekly downloads).
- Clear open-source license (ISC).
- Lean dependency tree (2 direct dependencies).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use once?
No — once should not be adopted for new projects. Last published 3655 days ago.
How do I install once?
Run `npm install once` to add once to your npm project.
How many dependencies does once have?
once declares 2 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved.
What license is once released under?
once is distributed under the ISC license.
How popular is once?
once has approximately 109,583,927 downloads per week and 1 known dependent packages.
Is once still maintained?
The most recent release of once (v1.4.0) was published 10 years ago.
Does once run install scripts?
No. once does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.