{"_id":"@bitfinex/lib-js-util-promise","name":"@bitfinex/lib-js-util-promise","dist-tags":{"latest":"1.1.0"},"versions":{"1.1.0":{"name":"@bitfinex/lib-js-util-promise","version":"1.1.0","description":"Bitfinex Lib Utility for Promises","main":"index.js","scripts":{"docs":"jsdoc2md --no-cache --files  ./src/*.js ./src/**/*.js > docs/DEFINITIONS.md","format":"standard --fix","lint":"standard","test":"npm run lint && npm run unit","unit":"NODE_ENV=test mocha ./test"},"keywords":["promise","utils","timeout"],"author":{"name":"vigan.abd"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/bitfinexcom/lib-js-util-promise.git"},"bugs":{"url":"https://github.com/bitfinexcom/lib-js-util-promise/issues"},"homepage":"https://github.com/bitfinexcom/lib-js-util-promise#readme","devDependencies":{"chai":"^4.3.7","chai-as-promised":"^7.1.1","dirty-chai":"^2.0.1","jsdoc-to-markdown":"^7.0.1","mocha":"^10.0.2","standard":"^17.0.0"},"standard":{"globals":["it","describe","before","after","beforeEach","afterEach"]},"gitHead":"23d49b4d2438d825b058a3515512b502b7f8d468","types":"./index.d.ts","_id":"@bitfinex/lib-js-util-promise@1.1.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-siDAnfH18/8O/RxCABGTTav+p0lDQFXdwRwU4vTGMDt+TEyKvH2kEC4blbGFadWJpWph9rjEjApRH2Uv7dXZ1g==","shasum":"ffca6dd1f5c3cb17fd1e8e6a1b68d7f0763505c4","tarball":"https://registry.npmjs.org/@bitfinex/lib-js-util-promise/-/lib-js-util-promise-1.1.0.tgz","fileCount":24,"unpackedSize":22402,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCz1XEIebzT183AZjFeTaN0KJIKxoOkUdHEiFlcMKoL7QIgSEfuLwB8zBmlm2yJZwUphi/Y6x7TrauldaqLY+O7bg4="}]},"_npmUser":{"name":"vigan-abd","email":"vigan.abd@gmail.com"},"directories":{},"maintainers":[{"name":"vigan-abd","email":"vigan.abd@gmail.com"},{"name":"bitfinexorg","email":"paolo@bitfinex.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lib-js-util-promise_1.1.0_1787251405648_0.8290433887801976"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-20T18:43:25.505Z","1.1.0":"2026-08-20T18:43:25.785Z","modified":"2026-08-20T18:43:26.098Z"},"maintainers":[{"name":"vigan-abd","email":"vigan.abd@gmail.com"},{"name":"bitfinexorg","email":"paolo@bitfinex.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"description":"Bitfinex Lib Utility for Promises","homepage":"https://github.com/bitfinexcom/lib-js-util-promise#readme","keywords":["promise","utils","timeout"],"repository":{"type":"git","url":"git+https://github.com/bitfinexcom/lib-js-util-promise.git"},"author":{"name":"vigan.abd"},"bugs":{"url":"https://github.com/bitfinexcom/lib-js-util-promise/issues"},"license":"MIT","readme":"# lib-js-util-promise\n\nThe lib includes the utilities depicted below:\n- promiseFlat - applies function to iterable and executes returned promises concurrently with optional limit\n- promiseSleep - promise version of setTimeout\n- promiseTimeout - wraps the promise/async function with a timeout so it doesn't run forever\n- resolvePromiseCb - calls the callback or resolves the Promise if no cb\n- waitForCondition - wait for sometime until an action resolves to a truthy result \n\n## Installing\n\n```console\nnpm install --save https://github.com/bitfinexcom/lib-js-util-promise.git\n```\n\n## Testing\n\n```console\nnpm run test\n```\n\n## Usage\n\n```javascript\nconst { promiseSleep, promiseTimeout } = require('@bitfinex/lib-js-util-promise')\n\nconst someSlowFunc = async () => {\n  await promiseSleep(5000) // wait 5s\n  return ['user 1', 'user 2']\n}\n\nconst main = async () => {\n  try {\n    await promiseTimeout(someSlowFunc(), 3000) // wait max 3s\n  } catch (err) {\n    console.error(err) // should reach here\n  }\n}\n\nmain()\n\n```\n\nMore examples can be found under examples directory!\n\n## Authors\n- vigan.abd\n","readmeFilename":"README.md","_rev":"1-f7f036942541a5f81176a8a0d275d965"}