VOOZH about

URL: https://gist.github.com/Guseyn?page=2

⇱ Guseyn’s gists · GitHub


Skip to content
Sign in Sign up

Instantly share code, notes, and snippets.

👁 View Guseyn's full-sized avatar
🎵
Enjoying Writing Music With Words

Guseyn Ismayylov Guseyn

🎵
Enjoying Writing Music With Words
Founder of Unison. Creator of EHTML. Creator of nodes.js (NodeJS Procedural Backend Framework with Cluster API based on HTTP/2.).
View GitHub Profile
function mapLimit (col, limit, mapFunc, doneFunc, newCol = [], index = { value: 0 }, freeThreads = { value: limit }) {
if (freeThreads.value > 0 && index.value < col.length) {
// Save current index
const curIndex = index.value
// Now the number of free threads is lower on 1
freeThreads.value -= 1
mapFunc((err, newItem) => {
if (err) {
// Smth bad happend, we call doneFunc with err
const assert = require('assert')
function flattenArray (nestedArray, resArray = []) {
for (let i = 0; i < nestedArray.length; i++) {
if (Array.isArray(nestedArray[i])) {
flattenArray(nestedArray[i], resArray)
} else {
resArray.push(nestedArray[i])
}
}
NewerOlder
You can’t perform that action at this time.