Back to Explore

sindresorhus/p-locate

GitHub
1 watchersOpen source

Last release: 3 months ago

p-locate is a small JavaScript utility that searches through an iterable (or async iterable) of values/promises and returns the first item whose resolved value makes a provided tester function return true. It is useful when you need an async equivalent of Array.find, for example finding the first file that exists on disk while testing items in order.

Project status

  • Actively maintained, most recently updated on 2026-02-03 (v7.0.0).
  • Update cadence appears sporadic, with large gaps between major updates (v5.0.0 in 2020, v6.0.0 in 2021, then v7.0.0 in 2026).

AI summary generated Today

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

Recent updates

  • v7.0.0

    3 months ago

    v7.0.0 makes Node.js 20 the minimum supported runtime and adds support for passing AsyncIterable inputs to p-locate. The implementation includes a separate code path for AsyncIterable that iterates serially until the tester returns true.

    BreakingFeatures
  • v6.0.0

    8/25/2021

    This release (v6.0.0) updates p-locate to a pure ESM package and raises the supported Node.js versions. The implementation and TypeScript typings were adjusted accordingly, and several dependencies were bumped (notably p-limit).

    Breaking
  • v5.0.0

    8/10/2020

    Release v5.0.0 primarily updates runtime requirements to Node.js 10+ and changes how TypeScript users should import p-locate (CommonJS-style). The code diff also shows a runtime change to module exports and several dependency/tooling upgrades, which are not fully covered by the release notes.

    Breaking