Skip to content

listify

Convert an object to a list, mapping each entry into a list item.

Usage

const a = { a: 1, b: 2, c: 3 };
listify(a, (key, value) => ({ key, value }));
// => [
// { key: 'a', value: 1 },
// { key: 'b', value: 2 },
// { key: 'c', value: 3 }
// ]

Installation

Terminal window
npx atmx add helper listify