Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9344365
es.string.ends-with.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
es.string.ends-with.js
View Options
'use strict'
;
var
$
=
require
(
'../internals/export'
);
var
uncurryThis
=
require
(
'../internals/function-uncurry-this'
);
var
getOwnPropertyDescriptor
=
require
(
'../internals/object-get-own-property-descriptor'
).
f
;
var
toLength
=
require
(
'../internals/to-length'
);
var
toString
=
require
(
'../internals/to-string'
);
var
notARegExp
=
require
(
'../internals/not-a-regexp'
);
var
requireObjectCoercible
=
require
(
'../internals/require-object-coercible'
);
var
correctIsRegExpLogic
=
require
(
'../internals/correct-is-regexp-logic'
);
var
IS_PURE
=
require
(
'../internals/is-pure'
);
// eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
var
un$EndsWith
=
uncurryThis
(
''
.
endsWith
);
var
slice
=
uncurryThis
(
''
.
slice
);
var
min
=
Math
.
min
;
var
CORRECT_IS_REGEXP_LOGIC
=
correctIsRegExpLogic
(
'endsWith'
);
// https://github.com/zloirock/core-js/pull/702
var
MDN_POLYFILL_BUG
=
!
IS_PURE
&&
!
CORRECT_IS_REGEXP_LOGIC
&&
!!
function
()
{
var
descriptor
=
getOwnPropertyDescriptor
(
String
.
prototype
,
'endsWith'
);
return
descriptor
&&
!
descriptor
.
writable
;
}();
// `String.prototype.endsWith` method
// https://tc39.es/ecma262/#sec-string.prototype.endswith
$
({
target
:
'String'
,
proto
:
true
,
forced
:
!
MDN_POLYFILL_BUG
&&
!
CORRECT_IS_REGEXP_LOGIC
},
{
endsWith
:
function
endsWith
(
searchString
/* , endPosition = @length */
)
{
var
that
=
toString
(
requireObjectCoercible
(
this
));
notARegExp
(
searchString
);
var
endPosition
=
arguments
.
length
>
1
?
arguments
[
1
]
:
undefined
;
var
len
=
that
.
length
;
var
end
=
endPosition
===
undefined
?
len
:
min
(
toLength
(
endPosition
),
len
);
var
search
=
toString
(
searchString
);
return
un$EndsWith
?
un$EndsWith
(
that
,
search
,
end
)
:
slice
(
that
,
end
-
search
.
length
,
end
)
===
search
;
}
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 4, 2:22 PM (2 d, 9 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3322049
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment