UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

36 lines (35 loc) 959 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isString = void 0; // @ts-nocheck const getTag_1 = __importDefault(require("./.internal/getTag")); /** * Checks if `value` is classified as a `String` primitive or object. * * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * ```js * isString('abc') * // => true * * isString(1) * // => false * ``` */ function isString(value) { const type = typeof value; return type === "string" || (type === "object" && value != null && !Array.isArray(value) && (0, getTag_1.default)(value) == "[object String]"); } exports.isString = isString; exports.default = isString;