Skip to content

Instantly share code, notes, and snippets.

@baudehlo
Created January 17, 2014 21:33
Show Gist options
  • Save baudehlo/8482025 to your computer and use it in GitHub Desktop.
Save baudehlo/8482025 to your computer and use it in GitHub Desktop.
var connection = {
notes: { fcrds: { fcrdns: "Hello World" } }
};
var thing_we_want = "notes.fcrds.fcrdns";
var thing = connection;
var parts = thing_we_want.split('.');
while(parts.length > 0) {
thing = thing[parts.shift()];
if (thing == null) break;
}
if (thing == null) throw "Not found";
console.log("We found: " + thing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment