</>PackageGraphPackageGraph

once

npmv1.4.0

Run 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.

1
Direct dependencies

Runtime packages this one declares itself.

1
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Licenses in the dependency tree

ISC

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.

javascriptFull 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.

PackageWeekly downloadsDependentsLicenseLast release
oncethis page109.6M1ISC10 years ago
callsites136.7M1MIT1 day ago
reusify91M1MIT1 day ago
call-bind80.7M5MIT1 day ago
generate-function12M1MIT1 day ago
split-on-first9.7M1MIT1 day ago

Dependencies

Declared by once v1.4.0. Runtime dependencies are installed with the package; dev dependencies are not.

Runtime (1)

Dev (1)

tap ^7.0.1

Used by

Popular packages that depend on once.

Relationship graph

Dependencies (left) and dependents (right) of once.

wrappyexpressonce
once dependencies dependents

Frequently installed together

Release history

No releases in the last two years, typically about 291 days apart.

Recent versions of once
VersionPublishedSizeLicense
1.4.0latest10 years agoISC
1.3.310 years agoISC
1.3.211 years agoISC
1.3.112 years agoBSD
1.3.013 years agoBSD
1.2.013 years agoBSD
1.1.114 years agoBSD

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

Keywords

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.