arbitrary-promise
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "arbitrary-promise", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "ArbitraryPromise is a simple Promise library that allows you to make your own arbitrarily named resolve/then functions.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -1,2 +0,2 @@ | ||
# arbitrary-promise | ||
# arbitrary-promise | ||
@@ -8,1 +8,44 @@ ArbitraryPromise is a simple Promise library that allows you to make your own arbitrarily named resolve/then functions. | ||
[![npm](https://img.shields.io/npm/v/arbitrary-promise.svg)](https://npmjs.com/package/arbitrary-promise) | ||
## Examples | ||
Go with a classic: | ||
```js | ||
import ArbitraryPromise from 'arbitrary-promise' | ||
const promise = new ArbitraryPromise([['resolve', 'then']]) | ||
promise.then(console.log) | ||
promise.resolve('Mathematical!') | ||
``` | ||
-> `Mathematical!` | ||
Or, spice it up with what this library provides, customization! | ||
```js | ||
import ArbitraryPromise from 'arbitrary-promise' | ||
const promise = new ArbitraryPromise([['handleData', 'onData']]) | ||
promise.onData(console.log) | ||
promise.handleData('Whoa! Algebraic!') | ||
``` | ||
-> `Whoa! Algebraic!` | ||
Of course, the promise will also work in reverse order, it being a promise and all: | ||
```js | ||
import ArbitraryPromise from 'arbitrary-promise' | ||
const promise = new ArbitraryPromise([['handleData', 'onData']]) | ||
promise.handleData('Whoa! Algebraic!') | ||
promise.onData(console.log) | ||
``` | ||
-> `Whoa! Algebraic!` | ||
Check out [the tests](./test/module.spec.js) for all the info, of which there is not much more than what you already know :) |
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
55854
51