Bug 865135 - Uplift Add-on SDK integration branch to Firefox.

This commit is contained in:
Wes Kocher
2013-04-26 02:04:23 -07:00
parent bae67bb95d
commit 71f44349f6
31 changed files with 979 additions and 245 deletions

View File

@@ -13,6 +13,7 @@ module.metadata = {
};
const { setTimeout } = require("../timers");
const { deprecateFunction } = require("../util/deprecate");
/**
* Takes `lambda` function and returns a method. When returned method is
@@ -55,14 +56,15 @@ function invoke(callee, params, self) callee.apply(self, params);
exports.invoke = invoke;
/**
* Curries a function with the arguments given.
* Takes a function and bind values to one or more arguments, returning a new
* function of smaller arity.
*
* @param {Function} fn
* The function to curry
* The function to partial
*
* @returns The function curried
* @returns The new function with binded values
*/
function curry(fn) {
function partial(fn) {
if (typeof fn !== "function")
throw new TypeError(String(fn) + " is not a function");
@@ -70,7 +72,12 @@ function curry(fn) {
return function() fn.apply(this, args.concat(Array.slice(arguments)));
}
exports.curry = curry;
exports.partial = partial;
exports.curry = deprecateFunction(partial,
'curry is deprecated, ' +
'please use require("sdk/lang/functional").partial instead.'
);
/**
* Returns the composition of a list of functions, where each function consumes