resolvable-promise
Advanced tools
Comparing version 1.0.2 to 2.0.0
{ | ||
"name": "resolvable-promise", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Promises with the resolve and reject functions exposed", | ||
"main": "index.js", | ||
"keywords": ["promise", "resolvable", "rejectable"], | ||
"main": "dist/index.js", | ||
"keywords": [ | ||
"promise", | ||
"resolvable", | ||
"rejectable" | ||
], | ||
"author": "WhiteAutumn", | ||
@@ -16,3 +20,31 @@ "license": "ISC", | ||
"url": "git+https://github.com/WhiteAutumn/resolvable-promise.git" | ||
} | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"test": "mocha .", | ||
"test:watch": "mocha --watch --reporter min .", | ||
"type-check": "tsc --noEmit", | ||
"prepublish": "npm run build", | ||
"build": "tsc" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.4", | ||
"@types/mocha": "^9.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.9.0", | ||
"@typescript-eslint/parser": "^5.9.0", | ||
"chai": "^4.3.4", | ||
"chai-as-promised": "^7.1.1", | ||
"esbuild-runner": "^2.2.1", | ||
"eslint": "^8.6.0", | ||
"mocha": "^9.1.3", | ||
"pre-commit": "^1.2.2", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
}, | ||
"pre-commit": [ | ||
"lint", | ||
"test" | ||
] | ||
} |
@@ -7,4 +7,2 @@ # resolvable-promise | ||
Oh, and I also added types. | ||
# | ||
@@ -21,26 +19,23 @@ | ||
The basic usage is as follows: | ||
```javascript | ||
const resolvable = makeResolvable(); | ||
```js | ||
import Resolvable from 'resolvable-promise'; | ||
resolvable | ||
.then(it => console.log(it)); | ||
const resolvable = new Resolvable(); | ||
resolvable.then(console.log); | ||
console.log("Resolving..."); | ||
resolvable.resolve("Resolved!"); | ||
console.log('Resolving...'); | ||
resolvable.resolve('Resolved!'); | ||
``` | ||
Where the console output will be: | ||
``` | ||
Resolving... | ||
Resolved! | ||
``` | ||
Looks like a Promise ✨ | ||
# | ||
### Arguments | ||
You can optionally provide `makeResolvable` with an executor callback just like a promise: | ||
```javascript | ||
const resolvable = makeResolvable((resolve, reject) => { | ||
// Do something async... | ||
resolve("Resolved!"); | ||
You can optionally provide `Resolvable` with an executor callback just like a promise: | ||
```js | ||
const resolvable = new Resolvable((resolve, reject) => { | ||
// Do something async.. | ||
resolve('Resolved!'); | ||
}); | ||
@@ -50,5 +45,6 @@ ``` | ||
It's also possible to provide it with a promise that you might have gotten from somewhere else: | ||
```javascript | ||
const res = fetch("https://swapi.dev/api/people/"); | ||
const resolvable = makeResolvable(res); | ||
```js | ||
const res = fetch('https://swapi.dev/api/people/'); | ||
const resolvable = new Resolvable(res); | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16321
18
213
13
48
1