Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romamaslennikov/5c924471b3e47334f44f1948f2ec5cf1 to your computer and use it in GitHub Desktop.
Save romamaslennikov/5c924471b3e47334f44f1948f2ec5cf1 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