{"_id":"@cjser/p-locate__v6_0_0","name":"@cjser/p-locate__v6_0_0","dist-tags":{"latest":"6.0.0-cjser.2"},"versions":{"6.0.0-cjser.2":{"name":"@cjser/p-locate__v6_0_0","version":"6.0.0-cjser.2","description":"Get the first fulfilled promise that satisfies the provided testing function","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","locate","find","finder","search","searcher","test","array","collection","iterable","iterator","race","fulfilled","fastest","async","await","promises","bluebird"],"dependencies":{"@cjser/p-limit__v4_0_0":"4.0.0-cjser.2"},"devDependencies":{"ava":"^3.15.0","delay":"^5.0.0","in-range":"^3.0.0","time-span":"^5.0.0","tsd":"^0.17.0","xo":"^0.44.0"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"6.0.0","cjserVersion":2,"original":{"name":"p-locate","version":"6.0.0","exports":"./index.js","repository":"sindresorhus/p-locate","dependencies":{"p-limit":"^4.0.0"},"files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/p-locate__v6_0_0@6.0.0-cjser.2","gitHead":"0168e4aac54a1a9ca6f921419fa5ed9edb53ef4a","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-lJ3P6Yx4UbuaENK9sL3eNopfh/P7mAOSLt0jyloTk3tI52qazjfm0wgPaIFRa/cn87zh5cRZSuMLenwh7bgbLQ==","shasum":"cce4a9f34e1a6241a4117cf91de9bb1abdd9aaeb","tarball":"https://registry.npmjs.org/@cjser/p-locate__v6_0_0/-/p-locate__v6_0_0-6.0.0-cjser.2.tgz","fileCount":6,"unpackedSize":10625,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB3woJMJkpB4zTNV7oBUE0FCd/WX4Nthyu8rMQdOQXOcAiEAxv78QFRXZfVmY5hEfcbzJ6nR821PDjUcYNwrE+tBJFk="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/p-locate__v6_0_0_6.0.0-cjser.2_1778130862009_0.0974304815797491"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T05:14:21.914Z","6.0.0-cjser.2":"2026-05-07T05:14:22.155Z","modified":"2026-05-07T05:14:22.340Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Get the first fulfilled promise that satisfies the provided testing function","keywords":["promise","locate","find","finder","search","searcher","test","array","collection","iterable","iterator","race","fulfilled","fastest","async","await","promises","bluebird"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# p-locate\n\n> Get the first fulfilled promise that satisfies the provided testing function\n\nThink of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).\n\n## Install\n\n```\n$ npm install p-locate\n```\n\n## Usage\n\nHere we find the first file that exists on disk, in array order.\n\n```js\nimport {pathExists} from 'path-exists';\nimport pLocate from 'p-locate';\n\nconst files = [\n\t'unicorn.png',\n\t'rainbow.png', // Only this one actually exists on disk\n\t'pony.png'\n];\n\nconst foundPath = await pLocate(files, file => pathExists(file));\n\nconsole.log(foundPath);\n//=> 'rainbow'\n```\n\n*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*\n\n## API\n\n### pLocate(input, tester, options?)\n\nReturns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.\n\n#### input\n\nType: `Iterable<Promise | unknown>`\n\nAn iterable of promises/values to test.\n\n#### tester(element)\n\nType: `Function`\n\nThis function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.\n\n#### options\n\nType: `object`\n\n##### concurrency\n\nType: `number`\\\nDefault: `Infinity`\\\nMinimum: `1`\n\nThe number of concurrently pending promises returned by `tester`.\n\n##### preserveOrder\n\nType: `boolean`\\\nDefault: `true`\n\nPreserve `input` order when searching.\n\nDisable this to improve performance if you don't care about the order.\n\n## Related\n\n- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently\n- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-p-locate?utm_source=npm-p-locate&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/p-locate\n","readmeFilename":"readme.md","_rev":"1-633a37d955850e3b42b1893cca6c7508"}