This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.asyncForEach = async function asyncForEach(fn, index = 0) { | |
await fn(this[index], index); | |
if (index + 1 === this.length) return; | |
await asyncForEach.call(this, fn, index + 1); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.asyncForEach = async function asyncForEach( | |
fn: (item: any, index: number) => void, | |
index: number = 0 | |
) { | |
await fn(this[index], index); | |
if (index + 1 === this.length) return; | |
await asyncForEach.call(this, fn, index + 1); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"title": "3D printing", | |
"category": "General", | |
"subCategory": "Indoors" | |
}, | |
{ | |
"title": "Acrobatics", | |
"category": "General", | |
"subCategory": "Indoors" |