mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
28 lines
772 B
JavaScript
28 lines
772 B
JavaScript
import baseGetTag from './.internal/baseGetTag.js'
|
|
import isObjectLike from './isObjectLike.js'
|
|
import nodeUtil from './.internal/nodeUtil.js'
|
|
|
|
/* Node.js helper references. */
|
|
const nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer
|
|
|
|
/**
|
|
* Checks if `value` is classified as an `ArrayBuffer` object.
|
|
*
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
|
* @example
|
|
*
|
|
* isArrayBuffer(new ArrayBuffer(2))
|
|
* // => true
|
|
*
|
|
* isArrayBuffer(new Array(2))
|
|
* // => false
|
|
*/
|
|
const isArrayBuffer = nodeIsArrayBuffer
|
|
? value => nodeIsArrayBuffer(value)
|
|
: value => isObjectLike(value) && baseGetTag(value) == '[object ArrayBuffer]'
|
|
|
|
export default isArrayBuffer
|