-
-
Save rwaldron/e4e0e349f9cf35ad3370 to your computer and use it in GitHub Desktop.
() vs. ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.prototype = { | |
get: function(key) { | |
return this.then({ (obj) obj[key]; }); | |
}, | |
put: function(key, val) { | |
return this.then({ (obj) obj[key] = val }); | |
}, | |
call: function(key, ...args ) { | |
// Can this Expression form have line breaks? | |
return this.then({ (obj) | |
obj[key].apply(obj, args) | |
}); | |
}, | |
addCallback: function(callback) { | |
return this.then(callback); | |
}, | |
addErrback: function(errback) { | |
// This was previously a no-op function expression | |
return this.then({() }, errback); | |
} | |
.... | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.prototype = { | |
get: function(key) { | |
return this.then({|obj| obj[key]; }); | |
}, | |
put: function(key, val) { | |
return this.then({|obj| obj[key] = val; }); | |
}, | |
call: function(key, ...args ) { | |
return this.then({|obj| | |
obj[key].apply(obj, args); | |
}); | |
}, | |
addCallback: function(callback) { | |
return this.then(callback); | |
}, | |
addErrback: function(errback) { | |
// This was previously a no-op function expression | |
return this.then({||}, errback); | |
} | |
.... | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment