PHP 7.4.33
Preview: index.js Size: 1.01 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/is-symbol/index.js
'use strict';

var callBound = require('call-bound');
var $toString = callBound('Object.prototype.toString');
var hasSymbols = require('has-symbols')();
var safeRegexTest = require('safe-regex-test');

if (hasSymbols) {
	var $symToStr = callBound('Symbol.prototype.toString');
	var isSymString = safeRegexTest(/^Symbol\(.*\)$/);

	/** @type {(value: object) => value is Symbol} */
	var isSymbolObject = function isRealSymbolObject(value) {
		if (typeof value.valueOf() !== 'symbol') {
			return false;
		}
		return isSymString($symToStr(value));
	};

	/** @type {import('.')} */
	module.exports = function isSymbol(value) {
		if (typeof value === 'symbol') {
			return true;
		}
		if (!value || typeof value !== 'object' || $toString(value) !== '[object Symbol]') {
			return false;
		}
		try {
			return isSymbolObject(value);
		} catch (e) {
			return false;
		}
	};
} else {
	/** @type {import('.')} */
	module.exports = function isSymbol(value) {
		// this environment does not support Symbols.
		return false && value;
	};
}

Directory Contents

Dirs: 2 × Files: 10
Name Size Perms Modified Actions
.github DIR
- drwxr-xr-x 2025-03-28 11:04:34
Edit Download
test DIR
- drwxr-xr-x 2025-03-28 11:04:34
Edit Download
276 B lrw-r--r-- 2025-03-28 11:04:34
Edit Download
151 B lrw-r--r-- 2025-03-28 11:04:34
Edit Download
139 B lrw-r--r-- 2025-03-28 11:04:34
Edit Download
16.14 KB lrw-r--r-- 2025-03-28 11:04:34
Edit Download
91 B lrw-r--r-- 2025-03-28 11:04:34
Edit Download
1.01 KB lrw-r--r-- 2025-03-28 11:04:34
Edit Download
1.06 KB lrw-r--r-- 2025-03-28 11:04:34
Edit Download
2.42 KB lrw-r--r-- 2025-03-28 11:04:34
Edit Download
1.64 KB lrw-r--r-- 2025-03-28 11:04:34
Edit Download
114 B lrw-r--r-- 2025-03-28 11:04:34
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).