Skip to content

Instantly share code, notes, and snippets.

View log4x
#!/usr/bin/yay
# Highlights log4j style messages
debug and trace are @boring
info is @normal
warning is @interesting
error is @serious
fatal is @serious
# some words that aren't logger levels but are still important
@jond3k
jond3k / gist:1352258
Created Nov 9, 2011
Two ways to crawl objects with an array of 'directions'. re: https://gist.github.com/1351684
View gist:1352258
var obj = {a:{b:{c:':D'}}};
var path = ['a','b','c'];
var path2 = ['a','b','c'];
console.log(crawl(obj, path));
console.log(crawl2(obj, path2));
function crawl2(obj, keys) {
while(keys.length) {
obj = obj[keys.shift()];
}
You can’t perform that action at this time.