fix map function and benchmark tests
This commit is contained in:
@@ -377,11 +377,8 @@ function Library (ronin) {
|
||||
}
|
||||
}
|
||||
|
||||
this.map = async (arr, fn) => { // Run a function on each element in a list.
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const arg = arr[i]
|
||||
arr[i] = await fn(arg)
|
||||
}
|
||||
this.map = (arr, fn) => { // Run a function on each element in a list.
|
||||
return Promise.all(arr.map(fn)).then( result => { return result } )
|
||||
}
|
||||
|
||||
this.filter = (arr, fn) => { // Remove from list, when function returns false.
|
||||
|
||||
Reference in New Issue
Block a user