Skip to content

Instantly share code, notes, and snippets.

@roobie
Created March 6, 2015 14:07
Show Gist options
  • Select an option

  • Save roobie/18d0f04f17df8ed46ce7 to your computer and use it in GitHub Desktop.

Select an option

Save roobie/18d0f04f17df8ed46ce7 to your computer and use it in GitHub Desktop.
key mirror array style
function aKeyMirror(list) {
var i, key, result = {};
if (!Array.isArray(list)) {
throw new Error('Argument must be an array.');
}
for(i = 0; i < list.length; i++) {
key = list[i];
result[key] = key;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment