Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-lazy

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-lazy - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

21

index.d.ts
/**
Create a lazy promise that defers execution until it's awaited or when `.then()` or `.catch()` is called.
*/
export default class PLazy<ValueType> extends Promise<ValueType> {
declare class PLazy<ValueType> extends Promise<ValueType> {
/**
Create a `PLazy` promise from a promise-returning or async function.
@example
```
import PLazy = require('p-lazy');
const lazyPromise = new PLazy(resolve => {
someHeavyOperation(resolve);
});
// `someHeavyOperation` is not yet called
(async () => {
await doSomethingFun;
// `someHeavyOperation` is called
console.log(await lazyPromise);
})();
```
*/

@@ -12,1 +29,3 @@ static from<ValueType>(

}
export = PLazy;

3

index.js

@@ -10,3 +10,2 @@ 'use strict';

this._executor = executor;
this._promise = null;
}

@@ -22,2 +21,3 @@

this._promise = this._promise || new Promise(this._executor);
// eslint-disable-next-line promise/prefer-await-to-then
return this._promise.then(onFulfilled, onRejected);

@@ -33,2 +33,1 @@ }

module.exports = PLazy;
module.exports.default = PLazy;
{
"name": "p-lazy",
"version": "2.0.0",
"version": "3.0.0",
"description": "Create a lazy promise that defers execution until it's awaited or when `.then()` or `.catch()` is called",

@@ -13,6 +13,6 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd-check"
"test": "xo && ava && tsd"
},

@@ -38,7 +38,7 @@ "files": [

"devDependencies": {
"ava": "^1.3.1",
"ava": "^1.4.1",
"delay": "^4.1.0",
"tsd-check": "^0.4.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc