You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
857 B
22 lines
857 B
1 month ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
var uncurryThis = require('../internals/function-uncurry-this');
|
||
|
var notARegExp = require('../internals/not-a-regexp');
|
||
|
var requireObjectCoercible = require('../internals/require-object-coercible');
|
||
|
var toString = require('../internals/to-string');
|
||
|
var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
|
||
|
|
||
|
var stringIndexOf = uncurryThis(''.indexOf);
|
||
|
|
||
|
// `String.prototype.includes` method
|
||
|
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
||
|
$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
||
|
includes: function includes(searchString /* , position = 0 */) {
|
||
|
return !!~stringIndexOf(
|
||
|
toString(requireObjectCoercible(this)),
|
||
|
toString(notARegExp(searchString)),
|
||
|
arguments.length > 1 ? arguments[1] : undefined
|
||
|
);
|
||
|
}
|
||
|
});
|