1
0

shim.js 533 B

12345678910111213141516
  1. 'use strict';
  2. var toInteger = require('../../../number/to-integer')
  3. , value = require('../../../object/valid-value')
  4. , min = Math.min, max = Math.max;
  5. module.exports = function (searchString/*, endPosition*/) {
  6. var self, start, endPos;
  7. self = String(value(this));
  8. searchString = String(searchString);
  9. endPos = arguments[1];
  10. start = ((endPos == null) ? self.length :
  11. min(max(toInteger(endPos), 0), self.length)) - searchString.length;
  12. return (start < 0) ? false : (self.indexOf(searchString, start) === start);
  13. };