Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rpldy/simple-state

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/simple-state

deep proxy object, so it's only updateable through an update method

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
decreased by-23.67%
Maintainers
1
Weekly downloads
 
Created
Source
npm version circleci status codecov status bundlephobia badge rpldy storybook

Simple State

Internal package

Deep proxies an object so it is only updateable through an update callback. outside an updater, it is impossible to make changes

It only proxies simple objects (not maps or sets) and arrays

It doesnt create new references and doesnt copy over anything

Original object is changed!

Installation

#Yarn: 
   $ yarn add @rpldy/simple-state 

#NPM:
   $ npm i @rpldy/simple-state

Example

import createState from "@rpldy/simple-state"

const { state, update } = createState({
    arr: [1,2,3]
});

state.arr.push(4);
console.log(state.arr); // print [1,2,3]

update((state) => {
    state.arr.push(4);
});

console.log(state.arr); // print [1,2,3,4]

FAQs

Package last updated on 03 Aug 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc