{"_id":"is-actual-promise","_rev":"289889","name":"is-actual-promise","description":"Verify if something is a Promise","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2023-10-06T06:27:48.000Z","created":"2023-08-06T05:09:07.681Z","1.0.0":"2023-08-06T05:09:07.681Z"},"users":{},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"repository":{"type":"git","url":"git+https://github.com/isaacs/is-actual-promise.git"},"versions":{"1.0.0":{"name":"is-actual-promise","version":"1.0.0","description":"Verify if something is a Promise","main":"./dist/cjs/index.js","module":"./dist/mjs/index.js","exports":{"./package.json":{"import":"./package.json","require":"./package.json"},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"scripts":{"preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","prepare":"tsc -p tsconfig/cjs.json && tsc -p tsconfig/esm.json && bash ./scripts/fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","format":"prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache","typedoc":"typedoc --tsconfig tsconfig/esm.json ./src/*.ts"},"keywords":["is promise","is","type","check","isPromise"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"BlueOak-1.0.0","repository":{"type":"git","url":"git+https://github.com/isaacs/is-actual-promise.git"},"devDependencies":{"prettier":"^2.8.2","sync-content":"^1.0.2","tap":"^18.0.0-5","typedoc":"^0.24.8","typescript":"^5.1.6"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"_id":"is-actual-promise@1.0.0","gitHead":"782fa5494e31627102ae5b04c79c7b9bb8c53064","types":"./dist/cjs/index.d.ts","bugs":{"url":"https://github.com/isaacs/is-actual-promise/issues"},"homepage":"https://github.com/isaacs/is-actual-promise#readme","_nodeVersion":"18.16.0","_npmVersion":"9.8.1","dist":{"shasum":"e37fc4ff63ca149a02b61f0f015c5d46b8f605fd","size":2267,"noattachment":false,"key":"/is-actual-promise/-/is-actual-promise-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/is-actual-promise/download/is-actual-promise-1.0.0.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-actual-promise_1.0.0_1691298547524_0.6980255156344162"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-06T05:09:07.681Z","publish_time":1691298547681,"_source_registry_name":"default","_cnpm_publish_time":1691298547681}},"readme":"# is-actual-promise\n\nSimilar to [`p-is-promise`](https://npmjs.com/p-is-promise) and\n[`is-promise`](https://npmjs.com/is-promise), which are also both\nfine alternatives to this.\n\nDifferences (ie, \"why this thing then?\")\n\n* This module is hybrid, so it can be used in either commonjs or\n  esm. `is-promise` is hybrid, but `p-is-promise` is ESM-only.\n* This module asserts that the tested value supplies the full\n  actual `Promise` interface, not just `PromiseLike` (ie, it also\n  asserts `.catch()` and `.finally()`. (`p-is-promise` tests for\n  `.catch()`, neither tests for `.finally()`.)\n* This module provides a named export rather than a default\n  export, which is a bit less of a hassle in some scenarios.\n* This module does not verify the resolution type of the Promise,\n  since that cannot be determined or verified, only that it's a\n  `Promise<any | void>`.\n\n(Note that this module does _not_ verify that the `.catch()`,\n`.then()`, and `.finally()` methods return Promises, because that\nis impossible at run-time without actually calling them. No\nduck-typing method should ever be considered fully\nauthoritative.)\n\n## USAGE\n\n```ts\nimport { isPromise } from 'is-actual-promise'\n\nconsole.log(isPromise(new Promise(() => {}))) // true\nconsole.log(isPromise((async () => true)())) // true\nconsole.log(isPromise(Promise.resolve(true))) // true\nconsole.log(isPromise({\n  then: async () => 5,\n  finally: async () => {},\n  catch: () => {},\n})) // true, but not accurate, limitation of duck typing\n```\n","_attachments":{},"homepage":"https://github.com/isaacs/is-actual-promise#readme","bugs":{"url":"https://github.com/isaacs/is-actual-promise/issues"},"license":"BlueOak-1.0.0"}