objectEntries: ObjectEntriesBus

A bus that passes an object or an iterable of key/value pairs through Object.entries or Object.fromEntries respectively.

Example

import * as io from "@prelude-io/core";

// => IORight containing `[["foo", 2], ["bar", 6]]`
console.log(io.objectEntries.deserialize({ foo: 2, bar: 6 }));

// => IORight containing `{ foo: 2, bar: 6 }`
console.log(
io.objectEntries.serialize([
["foo", 2],
["bar", 6],
])
);

When chaining this with io.HashMap, you will likely need to provide a type hint for the object's value type:

(io.objectEntries as io.ObjectEntriesBus<number>).chain(
io.HashMap(io.string, io.number)
);

Generated using TypeDoc