Created
August 20, 2014 17:15
-
-
Save jcromartie/0ecd2f22b5400b56db67 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function arrayAssocIn(obj, keys, val) { | |
var m = obj; | |
for (var ii = 0; ii < keys.length - 1; ii++) { | |
var k = keys[ii]; | |
m = m[k] = m[k] || []; | |
} | |
m[keys[keys.length - 1]] = val; | |
return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment