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. var context = require('./_string-context');
  5. var 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. });