isStringOrHole.js 338 B

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