isTypedArray.js 695 B

123456789101112131415161718192021222324252627
  1. var baseIsTypedArray = require('./_baseIsTypedArray'),
  2. baseUnary = require('./_baseUnary'),
  3. nodeUtil = require('./_nodeUtil');
  4. /* Node.js helper references. */
  5. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  6. /**
  7. * Checks if `value` is classified as a typed array.
  8. *
  9. * @static
  10. * @memberOf _
  11. * @since 3.0.0
  12. * @category Lang
  13. * @param {*} value The value to check.
  14. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  15. * @example
  16. *
  17. * _.isTypedArray(new Uint8Array);
  18. * // => true
  19. *
  20. * _.isTypedArray([]);
  21. * // => false
  22. */
  23. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  24. module.exports = isTypedArray;