function

function

Source:
the JS native Function class

Methods

isFunction(f) → {boolean}

Source:
checked if something is a function
Example

eg. usage

var f = function(){};

console.log(Function.isFunction(f)); // true

console.log(Function.isFunction(2)); // false

console.log(Function.isFunction(function(){})); // true

console.log(Function.isFunction(null)); // false
Parameters:
Name Type Description
f function the function to be checked
Returns:
Type
boolean

proxy(f, scope, …args) → {function}

Source:
proxies a function with scope and optional arguments

Example

eg. usage

var a = 1;
var b = new Date();
var c = function() {};

var scope = {
  prop1: 2.53,
  prop2: 'foo';
};

var f = function(a, b, c) {
  console.log(this.prop1, a, b, c);
}

f(a, b, c);
// it logs
undefined, 1, Date, function()

var pf = f.proxy(scope);
pf(a, b, c);
// it logs
2.53, 1, Date, function()

pf = f.proxy(scope, 2, null);
pf(a, b, c);
// it logs
2.53, 2, null, function()
Parameters:
Name Type Attributes Description
f function the function to be proxed
scope object the scope object (will be `this` inside the function)
args object <repeatable>
pass one or more arguments to override the original handled arguments
Returns:
Type
function