generator-ssjs
Version:
yo generator to scaffold an [SSJS Framework](https://adessose.github.io/ssjs-webpack/) project. ## Installation ``` # install yo npm install --global yo
29 lines (27 loc) • 984 B
JavaScript
function DynamicPolyfillCaller() {
this.getType = function (callee) {
if (callee === Array || Object.prototype.toString.call(callee) === '[object Array]') {
return 'array';
}
else if (callee === Object || (Object.prototype.toString.call(callee) === '[object Object]' && typeof callee !== 'function')) {
return 'object';
}
else if (callee === String || typeof callee === 'string') {
return 'string';
}
else if (callee === Number || typeof callee === 'number') {
return 'number';
}
return false;
}
this._functions = {};
this.getFunction = function (callee, funcName) {
return this._functions[funcName][this.getType(callee)]
}
this._call = function (callee, funcName, args) {
var f = this.getFunction(callee, funcName);
return f.apply(callee, args)
}
return this;
}
module.exports = { DynamicPolyfillCaller };