1
0

first-index.js 369 B

12345678910111213141516
  1. 'use strict';
  2. var toPosInt = require('../../number/to-pos-integer')
  3. , value = require('../../object/valid-value')
  4. , hasOwnProperty = Object.prototype.hasOwnProperty;
  5. module.exports = function () {
  6. var i, l;
  7. if (!(l = toPosInt(value(this).length))) return null;
  8. i = 0;
  9. while (!hasOwnProperty.call(this, i)) {
  10. if (++i === l) return null;
  11. }
  12. return i;
  13. };