Skip to content

Instantly share code, notes, and snippets.

@kpittman-securus
Created April 6, 2020 23:22
Show Gist options
  • Save kpittman-securus/65ee1611580c1e848a9141b09e3b75a5 to your computer and use it in GitHub Desktop.
Save kpittman-securus/65ee1611580c1e848a9141b09e3b75a5 to your computer and use it in GitHub Desktop.
const keymap = <T extends unknown, U extends object>(
object: U,
callback: (key: keyof U, index: number) => T
) => (Object.keys(object) as (keyof U)[]).map(callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment