Loops
Loops

Overview

A collection of small, type-safe, performant & immutable iteration utilities for arrays and objects.

npm versionnpm downloadsBundlephobia

Installation

Required dependencies

This package relies on React hooks (new tab) 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 (new tab). 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.

On this page