Back to Explore

isaacs/once

GitHub
1 watchersOpen source

Last release:

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

  • Maintenance status (based on provided evidence): The repo shows an upstream GitHub push on 2025-10-25, but the latest available published updates in the provided history are from 2022-02-27 (v1.4.1), which suggests low ongoing release activity (maintenance or quiet development rather than active, frequent releases).
  • Update cadence: Published updates appear extremely infrequent (large gaps, for example 2022 to 2016 in the visible history), indicating a long-running “mostly stable” project cadence. The 2025-10-25 push hints at some activity, but it is not reflected in additional tagged updates in the provided data.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v1.4.1

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

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

    Features
  • v1.3.3

    Release 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

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

    Breaking
  • v1.3.1

    This 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

    Release 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`.

    BreakingFeatures
  • v1.2.0

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

    Features
  • v1.1.1

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