Skip to content

Instantly share code, notes, and snippets.

@VoloshchenkoAl
Created February 1, 2017 06:47
Show Gist options
  • Save VoloshchenkoAl/6633b22464d2ccb07cb9dce4ac1278a2 to your computer and use it in GitHub Desktop.
Save VoloshchenkoAl/6633b22464d2ccb07cb9dce4ac1278a2 to your computer and use it in GitHub Desktop.
var findNodes = function (callback) {
var i = 100000,
nodes = [],
found;
// проверить, является ли объект callback функцией
if (typeof callback !== “function”) {
callback = false;
}
while (i) {
i -= 1;
// здесь находится сложная логика выбора узлов...
// теперь вызвать функцию callback:
if (callback) {
callback(found);
}
nodes.push(found);
}
return nodes;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment