Socket
Socket
Sign inDemoInstall

immutable-transactions

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    immutable-transactions

_immutable-transactions_ is a JavaScript library simplifying transactions in application state where you want to enforce strict immutability while still using native JavaScript objects and arrays.


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
48.6 kB
Created
Weekly downloads
 

Readme

Source

immutable-transactions

immutable-transactions is a JavaScript library simplifying transactions in application state where you want to enforce strict immutability while still using native JavaScript objects and arrays.

It´s a simple and lightweight alternative to Immutable.js or Seamless-Immutable.

Some features:

  • If the transaction didn't cause any changes, the previous object will be returned.
  • Make operations deep in a nested object using a list of keys, return the top object.
  • Supports negative array indexes.

Example

import { changeIn } from 'immutable-transactions'

const state = {
  ultimate: {
    answer: 41
  }
}

const nextState = changeIn(state, ['ultimate', 'answer'], previousValue => previousValue + 1)
// => {
//   ultimate: {
//     answer: 42
//   }
// }

See description of all methods in the declaration file

FAQs

Last updated on 18 Aug 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc