isStringOrHole.js 307 B

1234567
  1. 'use strict';
  2. var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false
  3. module.exports = function isStringOrHole(item, index, arr) {
  4. return typeof item === 'string' || (canDistinguishSparseFromUndefined ? !(index in arr) : typeof item === 'undefined');
  5. };