diff --git a/lib/postal.when.js b/lib/postal.when.js index 083e09e..379adff 100644 --- a/lib/postal.when.js +++ b/lib/postal.when.js @@ -1,7 +1,7 @@ /** * postal.when - A postal.js add-on enabling an aggregated response to a group of messages. * Author: Jim Cowart (http://freshbrewedcode.com/jimcowart) - * Version: v0.2.0 + * Version: v0.3.0 * Url: http://github.com/postaljs/postal.when * License(s): MIT */ @@ -9,11 +9,11 @@ if (typeof module === "object" && module.exports) { // Node, or CommonJS-Like environments module.exports = function (postal) { - return factory(require("underscore"), postal, this); + return factory(require("lodash"), postal, this); } } else if (typeof define === "function" && define.amd) { // AMD. Register as an anonymous module. - define(["underscore", "postal"], function (_, postal) { + define(["lodash", "postal"], function (_, postal) { return factory(_, postal, root); }); } else { @@ -31,7 +31,7 @@ _timeoutFn = setTimeout(function () { _onError({ type: "timeout", - data: _.pluck(_subscriptions, "data") + data: _.map(_subscriptions, "data") }); }, _options.timeout); } @@ -42,9 +42,9 @@ }); }, _checkFired = function () { - var _data = _.pluck(_subscriptions, "data"), + var _data = _.map(_subscriptions, "data"), _fn; - if (_.all(_data, _.identity)) { + if (_.every(_data, _.identity)) { clearTimeout(_timeoutFn); onSuccess.apply(this, _data); if (_options.once) { @@ -76,4 +76,4 @@ return new ForkJoin(queue, onSuccess, onError, options); }; return postal; -})); \ No newline at end of file +}));