Friday, 15 January 2010

promise - Bluebird .then method -



promise - Bluebird .then method -

the bluebird docs .call method have code sample labeled, "chaining lo-dash or underscore methods".

what purpose of chained .then(_) in code snippet below?

var promise = require("bluebird"); ... var _ = require("lodash"); var fs = promise.promisifyall(require("fs")); fs.readdirasync(".").then(_) <-- ??? .call("groupby", function(filename) { homecoming filename.charat(0); }) ...

thanks!

in underscore _ identifier function namespace.

doing .then returns result of passed function.

calling _ function starts underscore chain, consecutive actions happen on object passed. starts chain result of readdirasync.

promise bluebird

No comments:

Post a Comment