Skip to content

Instantly share code, notes, and snippets.

@Cmdv
Created May 25, 2016 21:49
Show Gist options
  • Save Cmdv/38e2c01c6e836790d25a5a705fee6903 to your computer and use it in GitHub Desktop.
Save Cmdv/38e2c01c6e836790d25a5a705fee6903 to your computer and use it in GitHub Desktop.
function map (toSomething, obj) {
const newObj = {}
const keys = Object.keys(obj)
for (let i = 0; i < keys.length; ++i) {
const name = keys[i]
newObject[name] = toSomething(obj[name])
}
return newObj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment