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

resolvable-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolvable-promise - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

.editorconfig

40

package.json
{
"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"
]
}

40

README.md

@@ -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);
```
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