shim.js 377 B

123456789101112
  1. 'use strict';
  2. var value = require('../../../object/valid-value')
  3. , toInteger = require('../../../number/to-integer')
  4. , max = Math.max, min = Math.min;
  5. module.exports = function (searchString/*, position*/) {
  6. var start, self = String(value(this));
  7. start = min(max(toInteger(arguments[1]), 0), self.length);
  8. return (self.indexOf(searchString, start) === start);
  9. };