1.0.1 • Published 8 years ago

minico v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

minico

npm version javascript standard style travis build coveralls coverage david dependencies david dev dependencies

It's like co, but tiny: Minimal Promise-based coroutines. Performant, with no fluff.

Based off of copromise.

npm install minico

Relies on Promise being global.

  • 592 bytes uncompressed
  • 453 bytes minified with uglify-js 2.6.2
  • 257 bytes minified with uglify-js 2.6.2, and compressed with gzip 1.8
import minico from 'minico'

const doThings = minico(function * doThings (input) {
  yield washDishes()
  try {
      yield makePopcorn()
  } catch (err) {
      yield someFailureHandler(err)
  }
  return 'nice' + input
})

doThings(2).then((value) => {
  console.log('Coroutine success:', value) // Coroutine success: nice2
}).catch((err) => {
  console.log('An error occured', err)
})