Comparing version 3.0.0 to 3.1.0
12
index.js
@@ -18,2 +18,14 @@ 'use strict'; | ||
static resolve(value) { | ||
return new PLazy(resolve => { | ||
resolve(value); | ||
}); | ||
} | ||
static reject(error) { | ||
return new PLazy((resolve, reject) => { | ||
reject(error); | ||
}); | ||
} | ||
then(onFulfilled, onRejected) { | ||
@@ -20,0 +32,0 @@ this._promise = this._promise || new Promise(this._executor); |
{ | ||
"name": "p-lazy", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Create a lazy promise that defers execution until it's awaited or when `.then()` or `.catch()` is called", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# p-lazy [![Build Status](https://travis-ci.org/sindresorhus/p-lazy.svg?branch=master)](https://travis-ci.org/sindresorhus/p-lazy) | ||
# p-lazy | ||
@@ -44,3 +44,11 @@ > Create a lazy promise that defers execution until it's awaited or when `.then()` or `.catch()` is called | ||
### PLazy.resolve(value) | ||
Create a `PLazy` promise that is resolved with the given `value`, or the promise passed as `value`. | ||
### PLazy.reject(reason) | ||
Create a `PLazy` promise that is rejected with the given `reason`. | ||
## Related | ||
@@ -47,0 +55,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4873
59
65