Skip to content

Instantly share code, notes, and snippets.

@sumhat
Created May 30, 2017 13:12
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 sumhat/268b560d8c89c4e7cf3be6a7d5f00fdc to your computer and use it in GitHub Desktop.
Save sumhat/268b560d8c89c4e7cf3be6a7d5f00fdc to your computer and use it in GitHub Desktop.
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