function.js
function lift(func /*, args... */) {
		var args = slice.call(arguments, 1);
		return function() {
			return _apply(func, this, args.concat(slice.call(arguments)));
		};
	}
function lift(func /*, args... */) {
		var args = slice.call(arguments, 1);
		return function() {
			return _apply(func, this, args.concat(slice.call(arguments)));
		};
	}
function lift ( func /*, args... */ ) { var args = slice . call ( arguments , 1 ) ; return function ( ) { return _apply ( func , this , args . concat ( slice . call ( arguments ) ) ) ; } ; }
Takes a 'regular' function and returns a version of that function that
returns a promise instead of a plain value, and handles thrown errors by
returning a rejected promise. Also accepts a list of arguments to be
prepended to the new function, as does Function.prototype.bind.

The resulting function is promise-aware, in the sense that it accepts
promise arguments, and waits for their resolution.

@example
function mayThrowError(n) {
if(n % 2 === 1) { // Normally this wouldn't be so deterministic :)
throw new Error("I don't like odd numbers");
} else {
return n;
}
}

var lifted = fn.lift(mayThrowError);

// Logs "I don't like odd numbers"
lifted(1).then(console.log, console.error);

// Logs '6'
lifted(6).then(console.log, console.error);

@example
function sumTwoNumbers(x, y) {
return x + y;
}

var sumWithFive = fn.lifted(sumTwoNumbers, 5);

// Logs '15'
sumWithFive(10).then(console.log, console.error);

@param {Function} func function to be bound
@param {...*} [args] arguments to be prepended for the new function
@returns {Function} a promise-returning function
Takes a regular function and returns a version of that function that returns a promise instead of a plain value and handles thrown errors by returning a rejected promise . Also accepts a list of arguments to be prepended to the new function as does Function . prototype . bind .