shim.js 389 B

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