Guest User

Untitled

a guest
Mar 17th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. 'use sctrict';
  2.  
  3. /**
  4. * Checks if value is an array.
  5. *
  6. * @author Douglas Crockford <douglas@crockford.com>
  7. * @see JavaScript The Good Parts, p. 61
  8. *
  9. * @param {*} value The value to be checked.
  10. * @returns {boolean}
  11. */
  12. exports.isArray = function (value) {
  13. return value &&
  14. typeof value === 'object' &&
  15. typeof value.length === 'number' &&
  16. typeof value.splice === 'function' &&
  17. !(value.propertyIsEnumerable('length'));
  18. };
Add Comment
Please, Sign In to add comment