salvoravida / structura.js

A very fast and lightweight Typescript library to create immutable states with a mutable syntax

Home Page:https://giusepperaso.github.io/structura.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Structura.js

structura

You can find complete docs at https://giusepperaso.github.io/structura.js/

Structura.js is a very fast and lightweight Typescript library which allows to create immutable states with a mutable syntax. It is based on the idea of structural sharing.

The library is very similar to Immer.js, but it has some advantages over it:

  • up to ~22x more performant, even faster than Immutable most of the time
  • freezes the object only at compile time by leveraging Typescript, while other libraries freeze the object at runtime with Object.freeze, which may be slow expecially for nested objects
  • circular and multiple references are supported
  • can return and modify the draft at the same time
  • flexibility in the return type of the producer
  • no need to toggle on/off features (with some exceptions)
  • does support transpositions and moves of portions of the draft

The library is actually in alpha state. It is probably already usable (many complex scenarios are already covered by tests), but the APIs and the types could change in the future.

About

A very fast and lightweight Typescript library to create immutable states with a mutable syntax

https://giusepperaso.github.io/structura.js/

License:MIT License


Languages

Language:TypeScript 99.6%Language:HTML 0.4%