{"_id":"@ai-zen/lazy-promise","_rev":"2-2e4b939c5257738b6b2b7ebc333ededd","name":"@ai-zen/lazy-promise","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@ai-zen/lazy-promise","version":"1.0.0","description":"LazyPromise is a TypeScript class that represents a lazy promise, which executes its executor function only when `then`, `catch`, or `finally` methods are called.","main":"dist/index.js","scripts":{"prepublishOnly":"tsc"},"keywords":[],"author":{"name":"LZQCN"},"license":"MIT","devDependencies":{"typescript":"^5.3.3"},"_id":"@ai-zen/lazy-promise@1.0.0","gitHead":"581c233d4c0eaea934756aee6c79e52ec6a4b7f0","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-ygXVK/IElb2N9qxOouZvEk1wWDj1lt/T5RDEP0wR8rxS3zOU7Os+s9cB3hxvRyvgOXxC5FSIG4jA9ThX0CcsLA==","shasum":"3a8e1e0d36e9ce99991cdc6b7dfd85a04bad7b40","tarball":"https://registry.npmjs.org/@ai-zen/lazy-promise/-/lazy-promise-1.0.0.tgz","fileCount":6,"unpackedSize":7595,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA/pTMjXPADg3WQ0H7CEAbfE2hcPtSAq9PcTqRcUHNFWAiEA7JuI8vTFHAjsDcFFYCPbsKLu8Q+9SbOKC3e3mFbCdPA="}]},"_npmUser":{"name":"lzqcn","email":"by.lzq@qq.com"},"directories":{},"maintainers":[{"name":"lzqcn","email":"by.lzq@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lazy-promise_1.0.0_1705776668758_0.30527703678320317"},"_hasShrinkwrap":false},"1.0.1":{"name":"@ai-zen/lazy-promise","version":"1.0.1","description":"LazyPromise is a TypeScript class that represents a lazy promise, which executes its executor function only when `then`, `catch`, or `finally` methods are called.","main":"dist/index.js","scripts":{"prepublishOnly":"tsc"},"keywords":[],"author":{"name":"LZQCN"},"license":"MIT","devDependencies":{"typescript":"^5.3.3"},"_id":"@ai-zen/lazy-promise@1.0.1","gitHead":"3de9084eb11365307cda1fa6dbe7a13b98f034e1","types":"./dist/index.d.ts","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-O3C10w6MQnz3JOJcjkV1Bollq0cM34vR4htQxl2pihYKmmempr0ObXgKNldVQ7w/4G7Xa7/Pmzglcay99MGUaw==","shasum":"e003777588fc0b2cb86cf310a888967848e96c5e","tarball":"https://registry.npmjs.org/@ai-zen/lazy-promise/-/lazy-promise-1.0.1.tgz","fileCount":7,"unpackedSize":9745,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCaQQH1QMF/m7dYlir+4vPDJCzKoA1hjN1+xSJBnqKwcQIhAOxF+yU/5SjX5xCgFLiHBLoQx1n2Nx7oIG0zJ2obeKqY"}]},"_npmUser":{"name":"lzqcn","email":"by.lzq@qq.com"},"directories":{},"maintainers":[{"name":"lzqcn","email":"by.lzq@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lazy-promise_1.0.1_1705776875646_0.1275601915397695"},"_hasShrinkwrap":false},"1.0.2":{"name":"@ai-zen/lazy-promise","version":"1.0.2","description":"LazyPromise is a TypeScript class that represents a lazy promise, which executes its executor function only when `then`, `catch`, or `finally` methods are called.","main":"dist/index.js","types":"dist/index.d.ts","type":"module","keywords":[],"author":{"name":"LZQCN"},"license":"MIT","devDependencies":{"typescript":"^5.3.3"},"scripts":{"build":"tsc"},"_id":"@ai-zen/lazy-promise@1.0.2","_integrity":"sha512-pT3FCXpKcQUDk+zG6qflbwSz0aFtyFam50O1fjiZGmYyUjJQ9X44mWXYJIvT3saa8tzpiS5rd0gX4FogOKfrEQ==","_resolved":"C:\\Users\\bylzq\\AppData\\Local\\Temp\\920d153efb9d2fbe988c7580a5f8244d\\ai-zen-lazy-promise-1.0.2.tgz","_from":"file:ai-zen-lazy-promise-1.0.2.tgz","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-pT3FCXpKcQUDk+zG6qflbwSz0aFtyFam50O1fjiZGmYyUjJQ9X44mWXYJIvT3saa8tzpiS5rd0gX4FogOKfrEQ==","shasum":"f9c86166e7b2adf893302f1b0f06209ec713353e","tarball":"https://registry.npmjs.org/@ai-zen/lazy-promise/-/lazy-promise-1.0.2.tgz","fileCount":7,"unpackedSize":9784,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHdEfPgdLLzNKM++/VhUxyIgTD7d9M1Bn3o5hA49fXfwIhAOnRplH1i+FwAIWTD06dOzJidYjreCBVoDkOb3jc3tzu"}]},"_npmUser":{"name":"lzqcn","email":"by.lzq@qq.com"},"directories":{},"maintainers":[{"name":"lzqcn","email":"by.lzq@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lazy-promise_1.0.2_1712601317549_0.07905651573636963"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-20T18:51:08.684Z","1.0.0":"2024-01-20T18:51:08.903Z","modified":"2024-04-08T18:35:17.900Z","1.0.1":"2024-01-20T18:54:35.840Z","1.0.2":"2024-04-08T18:35:17.702Z"},"maintainers":[{"name":"lzqcn","email":"by.lzq@qq.com"}],"description":"LazyPromise is a TypeScript class that represents a lazy promise, which executes its executor function only when `then`, `catch`, or `finally` methods are called.","keywords":[],"author":{"name":"LZQCN"},"license":"MIT","readme":"# LazyPromise\r\n\r\nLazyPromise is a TypeScript class that represents a lazy promise, which executes its executor function only when `then`, `catch`, or `finally` methods are called.\r\n\r\n## Installation\r\n\r\nInstall LazyPromise using npm:\r\n\r\n```bash\r\nnpm install @ai-zen/lazy-promise\r\n```\r\n\r\n## Usage\r\n\r\nImport LazyPromise class into your project:\r\n\r\n```javascript\r\nimport LazyPromise from \"@ai-zen/lazy-promise\";\r\n```\r\n\r\nCreate a new instance of LazyPromise by passing an executor function:\r\n\r\n```javascript\r\nconst lazyPromise = new LazyPromise((resolve, reject) => {\r\n  // Perform asynchronous operations and then call resolve or reject\r\n});\r\n```\r\n\r\nUse the `then` method to attach fulfillment and rejection handlers:\r\n\r\n```javascript\r\nlazyPromise.then(\r\n  (value) => {\r\n    // Handle the fulfilled promise\r\n  },\r\n  (reason) => {\r\n    // Handle the rejected promise\r\n  }\r\n);\r\n```\r\n\r\nUse the `catch` method to attach a rejection handler:\r\n\r\n```javascript\r\nlazyPromise.catch((reason) => {\r\n  // Handle the rejected promise\r\n});\r\n```\r\n\r\nUse the `finally` method to attach a handler when the promise is settled:\r\n\r\n```javascript\r\nlazyPromise.finally(() => {\r\n  // Perform cleanup or other operations\r\n});\r\n```\r\n\r\nNote: The executor function will only be executed when one of the above methods is called.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n","readmeFilename":"README.md"}