🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

structurajs

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

structurajs

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

0.12.6
latest
Source
npm
Version published
Weekly downloads
709
-13.54%
Maintainers
0
Weekly downloads
 
Created
Source

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 ~10x 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.

BREAKING CHANGES

  • v.0.9.0-alpha: produceWithStandardPatches was removed from the library; use enableStandardPatches(true) instead
  • v.0.8.0-alpha: patches use 'op' instead of 'action' as key for the operation; they can also be passed in the JSON format
  • v.0.6.0-alpha: revert back to accept primitives, just don't draft them; also accept the in operator
  • v.0.5.0-alpha: don't accept primitive types at runtime
  • v.0.4.0-alpha: primitive types are not accepted anymore in the produce function

Keywords

immutability

FAQs

Package last updated on 20 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts