faster filter

This commit is contained in:
Vyacheslav Matyukhin 2022-09-09 17:04:32 +04:00
parent 4d1f76f80e
commit 1187c0330a
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -73,19 +73,18 @@ module Internals = {
accessors: ProjectAccessorsT.t,
reducer: ProjectReducerFnT.t,
) => {
let mappedList = aValueArray->Belt.Array.reduceReverse(list{}, (acc, elem) => {
let newElem = Reducer_Expression_Lambda.doLambdaCall(
Js.Array2.filter(aValueArray, elem => {
let result = Reducer_Expression_Lambda.doLambdaCall(
aLambdaValue,
list{elem},
accessors,
reducer,
)
switch newElem {
| IEvBool(true) => list{elem, ...acc}
| _ => acc
switch result {
| IEvBool(true) => true
| _ => false
}
})
mappedList->Belt.List.toArray->Wrappers.evArray
})->Wrappers.evArray
}
}