import { mapEntries } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/object/index.js";
Applies the given transformer to all entries in the given record and returns a new record containing the results.
This function is effectively as
Object.fromEntries(Object.entries(obj).map(transformer))
.
Examples
Example 1
Example 1
import { mapEntries } from "@ayonli/jsext/object";
const obj = { foo: "Hello", bar: "World" };
const result = mapEntries(obj, ([key, value]) => [key, value.toUpperCase()]);
console.log(result); // { foo: "HELLO", bar: "WORLD" }