A small JavaScript utility that wraps a function so it runs exactly once, caching the first return value for later calls. Useful for preventing duplicate callbacks in event-driven code, and it also provides a `once.strict` variant that throws an error if the function is called more than one time.
Project status
- The repository appears to have ongoing activity, with the most recent upstream push dated 2025-10-25, but the provided tagged update history only goes up to v1.4.1 from 2022-02-27.
- Tagged updates are infrequent in the evidence shown (v1.3.3 in 2015, v1.4.0 in 2016, v1.4.1 in 2022), suggesting long-term stability or maintenance with occasional changes.
AI summary generated Today
Recent updates
v1.4.1
2/27/2022v1.4.1 appears to be a small release with no publisher-provided release notes. The code changes are limited, but there is a potentially user-facing change around how the proto helper is exported, plus tooling and CI updates and a devDependency upgrade.
v1.4.0
9/6/2016v1.4.0 introduces a new strict variant of the `once` wrapper, `once.strict`, intended to throw an error if the wrapped function is called more than once. It also exposes `Function.prototype.onceStrict` for the same behavior.
Featuresv1.3.3
11/20/2015Release v1.3.3 was published on 2015-11-20, but no release notes were provided by the publisher. As a result, there is no stated information about new features, fixes, security updates, or migration steps in the available data.
v1.3.2
5/4/2015Release v1.3.2 contains only metadata and license changes, with no observable runtime or API code modifications in the provided diff. The only substantive change is switching the project license from BSD to ISC and updating the corresponding license field in package.json.
Breakingv1.3.1
9/18/2014This release (v1.3.1) makes a small implementation change to the `once` module and adds a new runtime dependency. No release notes were provided, so the documented change list is empty.
v1.3.0
10/24/2013Release v1.3.0 changes the runtime behavior of the `once` wrapper so that it caches the original function's return value. Subsequent calls now return the cached value via a new `fn.value` property, rather than returning `undefined`.
BreakingFeaturesv1.2.0
8/12/2013This release adds support for checking whether the wrapped function has been called by exposing a `called` boolean on the returned wrapper function. There is no release-note content provided, so the change is effectively undocumented externally. The core once-only behavior remains, but the wrapper function now carries new observable state.
Featuresv1.1.1
8/14/2012Release v1.1.1 was published, but the publisher did not provide any release notes. As a result, there is no documented information about new features, bug fixes, breaking changes, or dependency updates in this release.