PHP 7.4.33
Preview: index.js Size: 830 B
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/is-async-function/index.js
'use strict';

var callBound = require('call-bound');
var safeRegexTest = require('safe-regex-test');

var toStr = callBound('Object.prototype.toString');
var fnToStr = callBound('Function.prototype.toString');
var isFnRegex = safeRegexTest(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/);

var hasToStringTag = require('has-tostringtag/shams')();
var getProto = require('get-proto');

var getAsyncFunc = require('async-function');

/** @type {import('.')} */
module.exports = function isAsyncFunction(fn) {
	if (typeof fn !== 'function') {
		return false;
	}
	if (isFnRegex(fnToStr(fn))) {
		return true;
	}
	if (!hasToStringTag) {
		var str = toStr(fn);
		return str === '[object AsyncFunction]';
	}
	if (!getProto) {
		return false;
	}
	var asyncFunc = getAsyncFunc();
	return asyncFunc && asyncFunc.prototype === getProto(fn);
};

Directory Contents

Dirs: 1 × Files: 9
Name Size Perms Modified Actions
test DIR
- drwxr-xr-x 2025-03-28 11:04:35
Edit Download
80 B lrw-r--r-- 2025-03-28 11:04:35
Edit Download
139 B lrw-r--r-- 2025-03-28 11:04:35
Edit Download
12.73 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
222 B lrw-r--r-- 2025-03-28 11:04:35
Edit Download
830 B lrw-r--r-- 2025-03-28 11:04:35
Edit Download
1.06 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
2.80 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
1.71 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
156 B lrw-r--r-- 2025-03-28 11:04:35
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).