Skip to content

Instantly share code, notes, and snippets.

@jessecurry
Created May 7, 2019 17:03
Show Gist options
  • Save jessecurry/9b0c61a75566ce2e3227c6db97cd9086 to your computer and use it in GitHub Desktop.
Save jessecurry/9b0c61a75566ce2e3227c6db97cd9086 to your computer and use it in GitHub Desktop.
keyMirror with namespaces
'use strict';
const keyMirror = (list, namespace) => {
let newList= {};
let prefix = namespace ? namespace + ":" : "";
Object.keys(list).map(element => {
var key = String(element);
newList[key] = prefix + element
});
return newList
}
export default keyMirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment