Skip to content

Instantly share code, notes, and snippets.

@ecowden
Last active January 18, 2016 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecowden/e01f9928f93d45536557 to your computer and use it in GitHub Desktop.
Save ecowden/e01f9928f93d45536557 to your computer and use it in GitHub Desktop.
Super simple example using `co`
const assert = require('assert')
const co = require('co')
return co(function* () {
let a = yield getDataAsync()
let b = yield getDataAsync()
let c = yield getDataAsync()
let actual = yield averageAsync([a, b, c])
let expected = (a + b + c) / 3
assert.equal(actual, expected)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment