Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Last active December 14, 2015 15:29
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 juliangruber/5108599 to your computer and use it in GitHub Desktop.
Save juliangruber/5108599 to your computer and use it in GitHub Desktop.
var ndsum = require("cwise")(function (a) {
sum += a
}, {
pre: function () {
var sum = 0;
},
post: function () {
return sum;
}
})
@juliangruber
Copy link
Author

cwise()
  .begin(function () { this.sum = 0 })
  .work(function (a) { this.sum += a })
  .end(function () { return this.sum })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment