mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Simplify isType modules.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
import baseGetTag from './.internal/baseGetTag.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
const arrayBufferTag = '[object ArrayBuffer]';
|
||||
|
||||
/**
|
||||
* The base implementation of `isArrayBuffer` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
||||
*/
|
||||
function baseIsArrayBuffer(value) {
|
||||
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
|
||||
}
|
||||
|
||||
export default baseIsArrayBuffer;
|
||||
@@ -1,18 +0,0 @@
|
||||
import baseGetTag from './.internal/baseGetTag.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const dateTag = '[object Date]';
|
||||
|
||||
/**
|
||||
* The base implementation of `isDate` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
||||
*/
|
||||
function baseIsDate(value) {
|
||||
return isObjectLike(value) && baseGetTag(value) == dateTag;
|
||||
}
|
||||
|
||||
export default baseIsDate;
|
||||
@@ -1,18 +0,0 @@
|
||||
import getTag from './.internal/getTag.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const mapTag = '[object Map]';
|
||||
|
||||
/**
|
||||
* The base implementation of `isMap` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
||||
*/
|
||||
function baseIsMap(value) {
|
||||
return isObjectLike(value) && getTag(value) == mapTag;
|
||||
}
|
||||
|
||||
export default baseIsMap;
|
||||
@@ -1,18 +0,0 @@
|
||||
import baseGetTag from './.internal/baseGetTag.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const regexpTag = '[object RegExp]';
|
||||
|
||||
/**
|
||||
* The base implementation of `isRegExp` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
||||
*/
|
||||
function baseIsRegExp(value) {
|
||||
return isObjectLike(value) && baseGetTag(value) == regexpTag;
|
||||
}
|
||||
|
||||
export default baseIsRegExp;
|
||||
@@ -1,18 +0,0 @@
|
||||
import getTag from './.internal/getTag.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const setTag = '[object Set]';
|
||||
|
||||
/**
|
||||
* The base implementation of `isSet` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
||||
*/
|
||||
function baseIsSet(value) {
|
||||
return isObjectLike(value) && getTag(value) == setTag;
|
||||
}
|
||||
|
||||
export default baseIsSet;
|
||||
@@ -1,60 +0,0 @@
|
||||
import baseGetTag from './.internal/baseGetTag.js';
|
||||
import isLength from './isLength.js';
|
||||
import isObjectLike from './isObjectLike.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const argsTag = '[object Arguments]';
|
||||
const arrayTag = '[object Array]';
|
||||
const boolTag = '[object Boolean]';
|
||||
const dateTag = '[object Date]';
|
||||
const errorTag = '[object Error]';
|
||||
const funcTag = '[object Function]';
|
||||
const mapTag = '[object Map]';
|
||||
const numberTag = '[object Number]';
|
||||
const objectTag = '[object Object]';
|
||||
const regexpTag = '[object RegExp]';
|
||||
const setTag = '[object Set]';
|
||||
const stringTag = '[object String]';
|
||||
const weakMapTag = '[object WeakMap]';
|
||||
|
||||
const arrayBufferTag = '[object ArrayBuffer]';
|
||||
const dataViewTag = '[object DataView]';
|
||||
const float32Tag = '[object Float32Array]';
|
||||
const float64Tag = '[object Float64Array]';
|
||||
const int8Tag = '[object Int8Array]';
|
||||
const int16Tag = '[object Int16Array]';
|
||||
const int32Tag = '[object Int32Array]';
|
||||
const uint8Tag = '[object Uint8Array]';
|
||||
const uint8ClampedTag = '[object Uint8ClampedArray]';
|
||||
const uint16Tag = '[object Uint16Array]';
|
||||
const uint32Tag = '[object Uint32Array]';
|
||||
|
||||
/** Used to identify `toStringTag` values of typed arrays. */
|
||||
const typedArrayTags = {};
|
||||
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
||||
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
||||
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
||||
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
||||
typedArrayTags[uint32Tag] = true;
|
||||
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
||||
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
||||
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
||||
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
||||
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
||||
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
||||
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
||||
typedArrayTags[weakMapTag] = false;
|
||||
|
||||
/**
|
||||
* The base implementation of `isTypedArray` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
||||
*/
|
||||
function baseIsTypedArray(value) {
|
||||
return isObjectLike(value) &&
|
||||
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
||||
}
|
||||
|
||||
export default baseIsTypedArray;
|
||||
Reference in New Issue
Block a user