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

arbitrary-promise

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arbitrary-promise - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"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 :)
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