asyncarray-aj
v1.1.3
Published
with this package you can do async mapping for array
Downloads
6
Readme
instalation!
npm i asyncarray-aj
import
import asyncArray from 'asyncarray-aj'
description
asyncArray(array,cb(currentValue,index))
its array looping
where you can make async action
Examples1
let newArray =asyncArray([2,3,4,5], ((elemnt,index)=>{
if(elemnt%2==0){
return element
}
}))
newArray.then(data=>{
console.log(data)
})
result 2 and 4
Examples2
let newArray =asyncArray(listids,async ((elemnt,index)=>{
let user = await axios.get('https://url.com/element')
if(user.name=="jack"){
return user
}
}).
newArray.then(data=>{
console.log(data)
})
result any user has jack as name.