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

var callBound = require('call-bound');

/** @type {(receiver: ThisParameterType<typeof String.prototype.valueOf>, ...args: Parameters<typeof String.prototype.valueOf>) => ReturnType<typeof String.prototype.valueOf>} */
var $strValueOf = callBound('String.prototype.valueOf');

/** @type {import('.')} */
var tryStringObject = function tryStringObject(value) {
	try {
		$strValueOf(value);
		return true;
	} catch (e) {
		return false;
	}
};
/** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
var $toString = callBound('Object.prototype.toString');
var strClass = '[object String]';
var hasToStringTag = require('has-tostringtag/shams')();

/** @type {import('.')} */
module.exports = function isString(value) {
	if (typeof value === 'string') {
		return true;
	}
	if (!value || typeof value !== 'object') {
		return false;
	}
	return hasToStringTag ? tryStringObject(value) : $toString(value) === strClass;
};

Directory Contents

Dirs: 2 × Files: 9
Name Size Perms Modified Actions
.github DIR
- drwxr-xr-x 2025-03-28 11:04:36
Edit Download
test DIR
- drwxr-xr-x 2025-03-28 11:04:36
Edit Download
87 B lrw-r--r-- 2025-03-28 11:04:36
Edit Download
159 B lrw-r--r-- 2025-03-28 11:04:36
Edit Download
14.19 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
88 B lrw-r--r-- 2025-03-28 11:04:36
Edit Download
1.03 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
1.06 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.49 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.16 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
123 B lrw-r--r-- 2025-03-28 11:04:36
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).