Socket
Socket
Sign inDemoInstall

immer

Package Overview
Dependencies
Maintainers
2
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immer - npm Package Compare versions

Comparing version 7.0.12 to 7.0.13

2

package.json
{
"name": "immer",
"version": "7.0.12",
"version": "7.0.13",
"description": "Create your next immutable state by mutating the current one",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -21,2 +21,3 @@ import {

} from "../internal"
import {isDraft} from "../utils/common"

@@ -133,3 +134,7 @@ interface ProxyBaseState extends ImmerBaseState {

},
set(state, prop: string /* strictly not, but helps TS */, value) {
set(
state: ProxyObjectState,
prop: string /* strictly not, but helps TS */,
value
) {
const desc = getDescriptorFromProto(latest(state), prop)

@@ -142,11 +147,15 @@ if (desc?.set) {

}
state.assigned_[prop] = true
if (!state.modified_) {
// the last check is because we need to be able to distinguish setting a non-existig to undefined (which is a change)
// from setting an existing property with value undefined to undefined (which is not a change)
if (
is(value, peek(latest(state), prop)) &&
(value !== undefined || has(state.base_, prop))
)
const current = peek(latest(state), prop)
// special case, if we assigning the original value to a draft, we can ignore the assignment
const currentState: ProxyObjectState = current?.[DRAFT_STATE]
if (currentState && currentState.base_ === value) {
state.copy_![prop] = value
state.assigned_[prop] = false
return true
}
if (is(value, current) && (value !== undefined || has(state.base_, prop)))
return true
prepareCopy(state)

@@ -157,2 +166,3 @@ markChanged(state)

state.copy_![prop] = value
state.assigned_[prop] = true
return true

@@ -159,0 +169,0 @@ },

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