mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 12:41:54 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_isTypedArray.js
|
|
|
|
|
|
/**
|
|
* Tests whether or not an object is a typed array.
|
|
*
|
|
* @private
|
|
* @param {*} val The object to test.
|
|
* @return {Boolean} `true` if `val` is a typed array, `false` otherwise.
|
|
* @example
|
|
*
|
|
* _isTypedArray(new Uint8Array([])); //=> true
|
|
* _isTypedArray(new Float32Array([])); //=> true
|
|
* _isTypedArray([]); //=> false
|
|
* _isTypedArray(null); //=> false
|
|
* _isTypedArray({}); //=> false
|
|
*/
|
|
export default function _isTypedArray(val) {
|
|
var type = Object.prototype.toString.call(val);
|
|
return type === '[object Uint8ClampedArray]' ||
|
|
type === '[object Int8Array]' || type === '[object Uint8Array]' ||
|
|
type === '[object Int16Array]' || type === '[object Uint16Array]' ||
|
|
type === '[object Int32Array]' || type === '[object Uint32Array]' ||
|
|
type === '[object Float32Array]' || type === '[object Float64Array]' ||
|
|
type === '[object BigInt64Array]' || type === '[object BigUint64Array]';
|
|
}
|