polygoat
polygoat is a tool to make functions support both callback and promise style.
- very small, < 30 lines of code
- no promise support/polyfill required
- simple, hack-free
- Node.js and browsers
- fast, see benchmark
Getting started
npm install polygoat
var pg = ;
or
var pg = windowpolygoat
Usage
// wrap an asynchronous function with polygoat { return } // hybridFunction can be used with promise style // or callback style // you can also pass the Promise implementation of your choicevar bluebird = { return } instanceof bluebird // true
Example
See example.js
Benchmark
See benchmark
Test
npm install standard
npm test
Goat icon by Agne Alesiute from the Noun Project