Created
May 30, 2017 13:12
-
-
Save sumhat/268b560d8c89c4e7cf3be6a7d5f00fdc 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 idLevel = 9999; | |
var config = null; | |
function getIdLevel(id) { | |
if (id == 1 || id == 3) return 0; | |
if (id == 2 || id == 4) return 1; | |
return 2; | |
} | |
for (var i : items) { | |
var item = items[i]; | |
if (item['config'] && getIdLevel(item['id']) <= idLevel) { | |
config = item['config']; | |
idLevel = getIdLevel(item['id']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment