mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Reinstate string.prototype.contains()
This adds a compatibility function aliased to string.prototype.includes().
This commit is contained in:
parent
083436313c
commit
591dc9ea93
1 changed files with 9 additions and 1 deletions
|
|
@ -1534,7 +1534,7 @@ RopeMatch(JSContext* cx, JSRope* text, JSLinearString* pat, int* match)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* ES6 draft rc4 21.1.3.7. */
|
||||
/* ES6 2015 ST 21.1.3.7 String.prototype.includes */
|
||||
bool
|
||||
js::str_includes(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
|
|
@ -1591,6 +1591,13 @@ js::str_includes(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* ES6 draft <RC4 String.prototype.contains for compatibility */
|
||||
bool
|
||||
js::str_contains(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return js::str_includes(cx, argc, vp);
|
||||
}
|
||||
|
||||
/* ES6 20120927 draft 15.5.4.7. */
|
||||
bool
|
||||
js::str_indexOf(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
|
@ -2555,6 +2562,7 @@ static const JSFunctionSpec string_methods[] = {
|
|||
JS_SELF_HOSTED_FN("padEnd", "String_pad_end", 2,0),
|
||||
JS_SELF_HOSTED_FN("codePointAt", "String_codePointAt", 1,0),
|
||||
JS_FN("includes", str_includes, 1,0),
|
||||
JS_FN("contains", str_contains, 1,0),
|
||||
JS_FN("indexOf", str_indexOf, 1,0),
|
||||
JS_FN("lastIndexOf", str_lastIndexOf, 1,0),
|
||||
JS_FN("startsWith", str_startsWith, 1,0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue