Skip to main content

@rx-angular/cdk/transformations

npm

A set of pure functions to update objects and collections immutably.

@rx-angular/cdk/transformations provides tree-shakeable, type-safe helpers for manipulating arrays and objects. Every helper returns a new value and never mutates its input, so the results are safe to feed into any state container that assumes immutable updates.

Key features

  • ✅ Manage objects and collections with an immutability guarantee
  • ✅ Reduce boilerplate for state changes
  • ✅ Type-safe and tree-shakeable functions
  • ✅ Produce serializable objects and arrays

The helpers are framework-agnostic. They pair naturally with rxState(), but because they are plain immutable updates they also work directly with an Angular signal, for example mySignal.update((s) => patch(s, update)) or myArray.update((a) => insert(a, item)).

Immutability is explained in the immutability & serializable state concept.

Import path

import { insert, update, remove, upsert, extract, toDictionary, patch, setProp, deleteProp, slice, toggle, dictionaryToArray } from '@rx-angular/cdk/transformations';

Install

npm install --save @rx-angular/cdk
# or
yarn add @rx-angular/cdk

See also