Skip to main content
variable mapKeys
import { mapKeys } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Creates an object with keys generated by running the provided function for each key and the same values as the provided object.

Use Object.keys(obj) to iterate over the object's keys. Use Array.prototype.reduce() to create a new object with the same values and mapped keys using fn.

type

(obj: AnyObject, fn: (
k: string,
) => string
) => unknown