Created
May 7, 2019 17:03
-
-
Save jessecurry/9b0c61a75566ce2e3227c6db97cd9086 to your computer and use it in GitHub Desktop.
keyMirror with namespaces
This file contains 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
'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