Skip to content

Instantly share code, notes, and snippets.

View clark800's full-sized avatar

Chris Clark clark800

  • San Francisco, CA
View GitHub Profile
@clark800
clark800 / simple-co.js
Created February 3, 2016 02:26
simplified co
'use strict';
function isGenerator(obj) {
return typeof obj.next === 'function' && typeof obj.throw === 'function';
}
// co returns a promise that resolves to the return value of the generator arg
function co(generator) {
return new Promise(resolve => {
function next(result) {