{"name":"defer-promise","version":"3.0.1","keywords":["defer","promise","es6","native","deferred"],"author":{"name":"Lloyd Brookes","email":"opensource@75lb.com"},"license":"MIT","_id":"defer-promise@3.0.1","maintainers":[{"name":"75lb","email":"opensource@75lb.com"}],"homepage":"https://github.com/75lb/defer-promise#readme","bugs":{"url":"https://github.com/75lb/defer-promise/issues"},"dist":{"shasum":"21e8c03efa36e9f160b127c6e203ccd2fe853409","tarball":"http://registry-npm.ywwl.com/defer-promise/download/defer-promise-3.0.1.tgz","fileCount":5,"integrity":"sha512-MVRQ3P18jCxgV9AKOut3FjUIQvM6SpvWH/Y6UgGD92cqpsHVWwny6nqD/seGrqI7YKZTG8Q3MqZFTfKRCfhH0A==","signatures":[{"sig":"MEQCIGwUt0ZkkHjdFImoPxWnxEZoNqitBhKuLSLqTakfy2I0AiASxx6UW3H89fpqppsCC4edNYLBKHcz5XFJctV1xNZ9IA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4796,"size":2222,"noattachment":false,"key":"/defer-promise/-/defer-promise-3.0.1.tgz"},"type":"module","engines":{"node":">=12.17"},"exports":{"import":"./index.js","require":"./dist/index.cjs"},"gitHead":"864d591e8ce16419c7ff206ea21a1a9819e7116d","scripts":{"dist":"rollup -c","test":"npm run dist && test-runner test.js","test:ci":"test-runner test.js"},"_npmUser":{"name":"75lb","email":"opensource@75lb.com"},"repository":{"url":"git+https://github.com/75lb/defer-promise.git","type":"git"},"_npmVersion":"11.6.2","description":"Isomorphic function returning a deferred promise. Uses native `Promise.defer` if available, else polyfills.","directories":{},"_nodeVersion":"25.0.0","_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.59.0","test-runner":"^0.10.1"},"_npmOperationalInternal":{"tmp":"tmp/defer-promise_3.0.1_1772888439381_0.21596739337920834","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deferred promises have been standardised by the native Promise.withResolvers() method. This library will continue to function correctly but will no longer be maintained.","readme":"[![view on npm](https://badgen.net/npm/v/defer-promise)](https://www.npmjs.org/package/defer-promise)\n[![npm module downloads](https://badgen.net/npm/dt/defer-promise)](https://www.npmjs.org/package/defer-promise)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/defer-promise)](https://github.com/75lb/defer-promise/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/defer-promise)](https://github.com/75lb/defer-promise/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/defer-promise/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/defer-promise/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n***Deprecated. Deferred promises have been standardised by the native [Promise.withResolvers()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) method. This library will continue to function correctly but will no longer be maintained.***\n\n# defer-promise\n\nIsomorphic function returning a deferred promise with `resolve` and `reject` methods. If the global `Promise.defer()` method exists it will use that, else polyfill.\n\n```js\nimport defer from 'defer-promise'\nconst deferred = defer()\n\n/* Async function using a callback instead of returning a promise */\ndoSomething((result, err) => {\n  if (err) {\n    deferred.reject(err)\n  } else {\n    deferred.resolve(result)\n  }\n})\n\nconst result = await deferred.promise;\n```\n\n## Load anywhere\n\nThis library can be loaded anywhere, natively without transpilation.\n\nCommon JS:\n\n```js\nconst defer = require('defer-promise')\n```\n\nNode.js with ECMAScript Module support enabled:\n\n```js\nimport defer from 'defer-promise'\n```\n\nModern browser ECMAScript Module:\n\n```js\nimport defer from './node_modules/defer-promise/index.js'\n```\n\n* * *\n\n&copy; 2015-26 Lloyd Brookes \\<opensource@75lb.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","publish_time":1772888439550,"_cnpm_publish_time":1772888439550,"dist-tags":{"latest":"3.0.1"}}