main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
857 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
| 4 | var notARegExp = require('../internals/not-a-regexp');
|
---|
| 5 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
---|
| 6 | var toString = require('../internals/to-string');
|
---|
| 7 | var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
|
---|
| 8 |
|
---|
| 9 | var stringIndexOf = uncurryThis(''.indexOf);
|
---|
| 10 |
|
---|
| 11 | // `String.prototype.includes` method
|
---|
| 12 | // https://tc39.es/ecma262/#sec-string.prototype.includes
|
---|
| 13 | $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
---|
| 14 | includes: function includes(searchString /* , position = 0 */) {
|
---|
| 15 | return !!~stringIndexOf(
|
---|
| 16 | toString(requireObjectCoercible(this)),
|
---|
| 17 | toString(notARegExp(searchString)),
|
---|
| 18 | arguments.length > 1 ? arguments[1] : undefined
|
---|
| 19 | );
|
---|
| 20 | }
|
---|
| 21 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.