X7ROOT File Manager
Current Path:
/lib/node_modules/npm/node_modules/is-callable
lib
/
node_modules
/
npm
/
node_modules
/
is-callable
/
ðŸ“
..
📄
.editorconfig
(286 B)
📄
.istanbul.yml
(993 B)
📄
.jscs.json
(4.03 KB)
📄
.travis.yml
(6.58 KB)
📄
CHANGELOG.md
(1.96 KB)
📄
LICENSE
(1.06 KB)
📄
Makefile
(3.74 KB)
📄
README.md
(1.93 KB)
📄
index.js
(1.09 KB)
📄
package.json
(2.85 KB)
📄
test.js
(5.41 KB)
Editing: index.js
'use strict'; var fnToStr = Function.prototype.toString; var constructorRegex = /^\s*class\b/; var isES6ClassFn = function isES6ClassFunction(value) { try { var fnStr = fnToStr.call(value); return constructorRegex.test(fnStr); } catch (e) { return false; // not a function } }; var tryFunctionObject = function tryFunctionToStr(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (typeof value === 'function' && !value.prototype) { return true; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = toStr.call(value); return strClass === fnClass || strClass === genClass; };
Upload File
Create Folder