1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibJS: Move MergeLists into non-Temporal ECMA-262 amendments

This is an editorial change in the Temporal spec.

See: 4ce3db1
This commit is contained in:
Linus Groh 2022-06-18 13:39:54 +01:00
parent 0c3d2b656e
commit 7a8e6cf6c6
5 changed files with 31 additions and 29 deletions

View file

@ -997,32 +997,4 @@ ThrowCompletionOr<Object*> default_merge_calendar_fields(GlobalObject& global_ob
return merged;
}
// 12.2.41 MergeLists ( a, b ), https://tc39.es/proposal-temporal/#sec-temporal-mergelists
Vector<String> merge_lists(Vector<String> const& a, Vector<String> const& b)
{
// 1. Let merged be a new empty List.
Vector<String> merged;
// 2. For each element element of a, do
for (auto const& element : a) {
// a. If merged does not contain element, then
if (!merged.contains_slow(element)) {
// i. Append element to merged.
merged.append(element);
}
}
// 3. For each element element of b, do
for (auto const& element : b) {
// a. If merged does not contain element, then
if (!merged.contains_slow(element)) {
// i. Append element to merged.
merged.append(element);
}
}
// 4. Return merged.
return merged;
}
}