{"name":"p-defer","version":"4.0.1","description":"Create a deferred promise","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-defer.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=12"},"scripts":{"test":"ava"},"keywords":["promise","defer","deferred","resolve","reject","lazy","later","async","await","promises"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.38.2"},"gitHead":"0f829029b6aae3f5699b1ea8838d3eea65fc98c2","bugs":{"url":"https://github.com/sindresorhus/p-defer/issues"},"homepage":"https://github.com/sindresorhus/p-defer#readme","_id":"p-defer@4.0.1","_nodeVersion":"18.19.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-Mr5KC5efvAK5VUptYEIopP1bakB85k2IWXaRC0rsh1uwn1L6M0LVml8OIQ4Gudg4oyZakf7FmeRLkMMtZW1i5A==","shasum":"d12c6d41420785ed0d162dbd86b71ba490f7f99e","tarball":"http://registry-npm.ywwl.com/p-defer/download/p-defer-4.0.1.tgz","fileCount":5,"unpackedSize":3835,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjAjmy9aZQEPlCLBF15zUaWwpgYaz8GkojOyfuuVmpmQIgWhuRyKWmwrqb8lXtrx+g9B6hSJK4YrI2QBcjP2TirOk="}],"size":1974,"noattachment":false,"key":"/p-defer/-/p-defer-4.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-defer_4.0.1_1711948523968_0.15241752506849715"},"_hasShrinkwrap":false,"readme":"# p-defer\n\n> Create a deferred promise\n\n[Don't use this unless you know what you're doing.](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern) Prefer the `Promise` constructor.\n\n## Install\n\n```sh\nnpm install p-defer\n```\n\n## Usage\n\n```js\nimport pDefer from 'p-defer';\n\nfunction delay(milliseconds) {\n\tconst deferred = pDefer();\n\tsetTimeout(deferred.resolve, milliseconds, '🦄');\n\treturn deferred.promise;\n}\n\nconsole.log(await delay(100));\n//=> '🦄'\n```\n\n*The above is just an example. Use [`delay`](https://github.com/sindresorhus/delay) if you need to delay a promise.*\n\n## API\n\n### pDefer()\n\nReturns an `object` with a `promise` property and functions to `resolve()` and `reject()`.\n\n## Related\n\n- [p-lazy](https://github.com/sindresorhus/p-lazy) - Create a lazy promise that defers execution until `.then()` or `.catch()` is called\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1711948524119,"_cnpm_publish_time":1711948524119,"dist-tags":{"latest":"4.0.1"}}