es6.string.includes.js 479 B

123456789101112
  1. // 21.1.3.7 String.prototype.includes(searchString, position = 0)
  2. 'use strict';
  3. var $export = require('./$.export')
  4. , context = require('./$.string-context')
  5. , INCLUDES = 'includes';
  6. $export($export.P + $export.F * require('./$.fails-is-regexp')(INCLUDES), 'String', {
  7. includes: function includes(searchString /*, position = 0 */){
  8. return !!~context(this, searchString, INCLUDES)
  9. .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
  10. }
  11. });