1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LibJS: Add the String.prototype.trim{Left, Right} aliases

These are the same as trim{Start, End} respectively.
This commit is contained in:
Idan Horowitz 2021-06-02 00:59:15 +03:00 committed by Andreas Kling
parent 33eb9a6ddc
commit de8d081ca4
2 changed files with 4 additions and 0 deletions

View file

@ -256,6 +256,8 @@ namespace JS {
P(trace) \
P(trim) \
P(trimEnd) \
P(trimLeft) \
P(trimRight) \
P(trimStart) \
P(trunc) \
P(undefined) \

View file

@ -78,7 +78,9 @@ void StringPrototype::initialize(GlobalObject& global_object)
define_native_function(vm.names.padEnd, pad_end, 1, attr);
define_native_function(vm.names.trim, trim, 0, attr);
define_native_function(vm.names.trimStart, trim_start, 0, attr);
define_property(vm.names.trimLeft, get(vm.names.trimStart, {}, true), attr);
define_native_function(vm.names.trimEnd, trim_end, 0, attr);
define_property(vm.names.trimRight, get(vm.names.trimEnd, {}, true), attr);
define_native_function(vm.names.concat, concat, 1, attr);
define_native_function(vm.names.substr, substr, 2, attr);
define_native_function(vm.names.substring, substring, 2, attr);