jsToolboxMJK.funcs.asFunc() - mkloubert/jsToolbox GitHub Wiki
$jsTB.funcs.asFunc(obj) method
Returns an object as getter function.
Syntax
$jsTB.funcs.asFunc(obj);
Parameters
Name | Type | Description |
---|---|---|
obj | Object | The object to convert. |
Result
The object as function or the object itself if it is already a function.
Examples
var obj1 = function() {
return 'TM';
};
var obj2 = 5979;
// obj1 itself
var f1 = $jsTB.funcs.asFunc(obj1);
// function() {
// return 5979;
// }
var f2 = $jsTB.funcs.asFunc(obj2);