8000 GitHub - skewten-archive/mini-copromise: Minimal Promise-based coroutines. Performant, with no fluff.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 10, 2018. It is now read-only.

skewten-archive/mini-copromise

CE2F
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mini-copromise

project status

Replaced with minico: It's the same thing.


A tinier Promise-based coroutine. Based off of copromise

Relies on the global Promise to work.

  • 592 bytes uncompressed
  • 453 bytes minified with uglify-js 2.6.2
  • 258 bytes minified with uglify-js 2.6.2, and compressed with gzip 1.8

npm install mini-copromise

import copromise from 'mini-copromise'

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

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

About

Minimal Promise-based coroutines. Performant, with no fluff.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0