PHP 8.1.33
Preview: index.js Size: 1.09 KB
//lib/node_modules/npm/node_modules/is-callable/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;
};

Directory Contents

Dirs: 0 × Files: 11

Name Size Perms Modified Actions
286 B lrw-r--r-- 2021-03-10 14:36:36
Edit Download
993 B lrw-r--r-- 2021-03-10 14:36:36
Edit Download
4.03 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
6.58 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
1.96 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
1.09 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
1.06 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
3.74 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
2.85 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
1.93 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
5.41 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).