Loops
Loops
Overview
A collection of small, type-safe, performant & immutable iteration utilities for arrays and objects.
Installation
Required dependencies
This package relies on React hooks and thus requires version 16.3 or higher.
# npm
npm i --save @weser/loops
# yarn
yarn add @weser/loops
# pnpm
pnpm add @weser/actions
Motivation
Because JavaScript's native "functional" APIs such as forEach
, reduce
, map
and filter
are slow and limited to arrays only.
There're many different utility packages out there already, e.g. lodash.
But lodash's reduce
method itself is 4.5kb gzipped which is way too much for a simple array/object reduce utility.
Additionally, it provides better type inference compared to the built-in methods.
© 2024-present Robin Weser. All Rights Reserved.