JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q14781F
  • License MIT

A lightweight immutability library compatible with JS built-in collections.

Package Exports

  • mutatis

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mutatis) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Mutatis

A lightweight immutability library.

Mutatis mutandis is a Medieval Latin phrase meaning “the necessary changes having been made” or “once the necessary changes have been made”.

Like immutable, but compatible with standard JS data structures, and with ~50Kb less code (minified).

Like seamless-immutable, but with the nice mutability helpers.

Like the React Immutability helpers, but without the weird MongoDB-inspired syntax.

Usage

import mutatis from 'mutatis';

const x = mutatis({a: 12, b: [23, 56]});
mutatis.size; // 2
mutatis.a = 78; // Throws

const y = x.set('c', {d: {e: 'string'});
// {a: 12, b: [23, 56], c: {d: {e: 'string'}}};

const z = y
  .setIn(['c', 'd', 'f'], 'another string')
  .update('b', l => l.concat(78));
// {a: 12, b: [23, 56, 78], c: {d: {e: 'string', f: 'another string'}}};

const a = mutatis([12, 34]);
a.push(56); // Throws