Last active
August 29, 2019 18:14
-
-
Save maxwellb/e0608ca9ef322599ac2e63cc7af6ae27 to your computer and use it in GitHub Desktop.
propsApply.ts
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
export default function propsApply<TIn, TOut>(_: { [index: string]: TIn }, fn: { (source: TIn): TOut }) { | |
return Object.keys(_).reduce( | |
(result, i) => { | |
result[i] = fn(_[i]); return result; | |
}, | |
{} as { [any: string]: TOut } | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment