Skip to content

Instantly share code, notes, and snippets.

@amiralies
Created July 25, 2019 15:33
Show Gist options
  • Select an option

  • Save amiralies/dca0e085bb7063a27175f20a0e996b73 to your computer and use it in GitHub Desktop.

Select an option

Save amiralies/dca0e085bb7063a27175f20a0e996b73 to your computer and use it in GitHub Desktop.

Revisions

  1. amiralies created this gist Jul 25, 2019.
    8 changes: 8 additions & 0 deletions map.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    const map = (obj, fun) =>
    Object.entries(obj).reduce(
    (prev, [key, value]) => ({
    ...prev,
    [key]: fun(key, value)
    }),
    {}
    );