UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

36 lines (35 loc) 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isTypedArray = void 0; const getTag_1 = __importDefault(require("./.internal/getTag")); const isObjectLike_1 = __importDefault(require("./isObjectLike")); /** * Used to match `toStringTag` values of typed arrays. * @ignore */ const reTypedTag = /^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/; /** * Checks if `value` is classified as a typed array. * * @since 5.5.0 * @category Lang * @param value The value to check. * @returns Returns `true` if `value` is a typed array, else `false`. * @example * * ```js * isTypedArray(new Uint8Array) * // => true * * isTypedArray([]) * // => false * ``` */ function isTypedArray(value) { return (0, isObjectLike_1.default)(value) && reTypedTag.test((0, getTag_1.default)(value)); } exports.isTypedArray = isTypedArray; exports.default = isTypedArray;