Created
July 17, 2016 16:09
-
-
Save romamaslennikov/5c924471b3e47334f44f1948f2ec5cf1 to your computer and use it in GitHub Desktop.
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
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