pinky-combinators

Sweet combinators for promises/a+

This library is not actively maintained anymore (bugfixes may still be released). The author has moved to working on data.future. If you want Promises/A+ check out bluebird
Last updated 8 years ago by killdream .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install pinky-combinators 
SYNC missed versions from official npm registry.

Pinky Combinators Build Status Dependencies Status

Sweet combinators for promises/a+.

Even though it uses pinky under the covers, it should be interoperable with any library implementing the promises/a+ specification.

Platform support

This library assumes an ES5 environment, but can be easily supported in ES3 platforms by the use of shims. Just include es5-shim :3

browser support

Example

var pinky = require('pinky')
var p = require('pinky-combinators')

// Sequencing operations
p.pipeline([ read('user.json')
           , JSON.parse
           , get('data')
           , JSON.stringify
           , write('data.json') ])
 .otherwise(function(e){ throw e })

// Or function-composition style f . g
p.compose([ splitLines, read('log.txt') ])
 .then(function(lines){ ... })

// Parallel computations
p.all([ read('a.txt'), read('b.txt'), read('c.txt') ])
 .then( function(as)  { console.log(as.join('\n')) }
      , function(err) { throw err                  })
 
// First come, first served
p.any([ request('http://api.example.com/foo')
      , request('http://api2.example.com/foo') ])
 .then(function(a){ saveToDatabase(a) }, function(err){ throw err })

Installing

Just grab it from NPM:

$ npm install pinky-combinators

Documentation

A quick reference of the API can be built using Calliope:

$ npm install -g calliope
$ calliope build

Tests

You can run all tests using Mocha:

$ npm test

Licence

MIT/X11. ie.: do whatever you want.

Current Tags

  • 0.1.1                                ...           latest (8 years ago)

3 Versions

  • 0.1.1 [deprecated]           ...           8 years ago
  • 0.1.0 [deprecated]           ...           8 years ago
  • 0.0.0 [deprecated]           ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (7)

Copyright 2014 - 2017 © taobao.org |