0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-11-10 15:03:23 +01:00
Doodle3D-API/jspm_packages/npm/core-js@0.9.18/modules/$.ctx.js

25 lines
527 B
JavaScript
Raw Normal View History

2015-07-15 15:06:18 +02:00
/* */
var assertFunction = require("./$.assert").fn;
module.exports = function(fn, that, length) {
assertFunction(fn);
if (~length && that === undefined)
return fn;
switch (length) {
case 1:
return function(a) {
return fn.call(that, a);
};
case 2:
return function(a, b) {
return fn.call(that, a, b);
};
case 3:
return function(a, b, c) {
return fn.call(that, a, b, c);
};
}
return function() {
return fn.apply(that, arguments);
};
};