Permalink
Browse files

Merge with v0.7

  • Loading branch information...
2 parents d6816c4 + c4b9cb1 commit 36bd639f7c86af9f4e333d7d4c4446394cd82aee @medikoo committed Apr 4, 2014
Showing with 8 additions and 8 deletions.
  1. +4 −4 ext/promise/{match.js → spread.js}
  2. +1 −1 index.js
  3. +3 −3 test/ext/promise/{match.js → spread.js}
@@ -1,6 +1,6 @@
-// 'match' - Promise extensions
+// 'spread' - Promise extensions
//
-// promise.match(onsuccess, onerror)
+// promise.spread(onsuccess, onerror)
//
// Matches eventual list result onto function arguments,
// otherwise works same as 'then' (promise function itself)
@@ -15,13 +15,13 @@ var spread = require('es5-ext/function/#/spread')
, resolve = deferred.resolve, reject = deferred.reject;
-deferred.extend('match', function (win, fail) {
+deferred.extend('spread', function (win, fail) {
var def;
((win == null) || callable(win));
if (!win && (fail == null)) return this;
if (!this.pending) this.pending = [];
def = deferred();
- this.pending.push('match', [win, fail, def.resolve, def.reject]);
+ this.pending.push('spread', [win, fail, def.resolve, def.reject]);
return def.promise;
}, function (win, fail, resolve, reject) {
var cb, value;
View
@@ -30,6 +30,6 @@ require('./ext/promise/get');
require('./ext/promise/invoke');
require('./ext/promise/invoke-async');
require('./ext/promise/map');
-require('./ext/promise/match');
+require('./ext/promise/spread');
require('./ext/promise/some');
require('./ext/promise/reduce');
@@ -6,7 +6,7 @@ module.exports = {
"Deferred": function (a) {
var defer = deferred(), w = {}, x = {}, y = {}, z = [x, y, w]
, invoked = false;
- defer.resolve(z).match(function (m, n, o) {
+ defer.resolve(z).spread(function (m, n, o) {
invoked = true;
a(m, x, "#1");
a(n, y, "#2");
@@ -16,15 +16,15 @@ module.exports = {
},
"Promise": function (a, d) {
var w = {}, x = {}, y = {}, z = [x, y, w];
- deferred(z).match(function (m, n, o) {
+ deferred(z).spread(function (m, n, o) {
a(m, x, "#1");
a(n, y, "#2");
a(o, w, "#3");
}).done(d, d);
},
"Error": function (a, d) {
var e = new Error('E!');
- deferred(e).match(a.never, function (err) {
+ deferred(e).spread(a.never, function (err) {
a(err, e);
}).done(d, d);
}

0 comments on commit 36bd639

Please sign in to comment.