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

immer

Package Overview
Dependencies
Maintainers
1
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 1.2.0 to 1.2.1

4

changelog.md
# Changelog
### 1.2.1
* Improved TypeScript and Flow typings to support return a new state from a producer. Trough [#131](https://github.com/mweststrate/immer/pull/131) by [dmorosinotto](https://github.com/mweststrate/immer/issues?q=is%3Apr+author%3Admorosinotto) resp [#127](https://github.com/mweststrate/immer/pull/127) by [bugzpodder](https://github.com/mweststrate/immer/pull/127)
### 1.2

@@ -4,0 +8,0 @@

22

dist/immer.d.ts

@@ -16,3 +16,3 @@ /**

currentState: S,
recipe: (this: S, draftState: S) => void
recipe: (this: S, draftState: S) => void | S
): S

@@ -23,3 +23,3 @@

export default function<S = any>(
recipe: (this: S, draftState: S) => void,
recipe: (this: S, draftState: S) => void | S,
initialState: S

@@ -29,3 +29,3 @@ ): (currentState: S | undefined) => S

export default function<S = any, A = any>(
recipe: (this: S, draftState: S, a: A) => void,
recipe: (this: S, draftState: S, a: A) => void | S,
initialState: S

@@ -35,3 +35,3 @@ ): (currentState: S | undefined, a: A) => S

export default function<S = any, A = any, B = any>(
recipe: (this: S, draftState: S, a: A, b: B) => void,
recipe: (this: S, draftState: S, a: A, b: B) => void | S,
initialState: S

@@ -41,3 +41,3 @@ ): (currentState: S | undefined, a: A, b: B) => S

export default function<S = any, A = any, B = any, C = any>(
recipe: (this: S, draftState: S, a: A, b: B, c: C) => void,
recipe: (this: S, draftState: S, a: A, b: B, c: C) => void | S,
initialState: S

@@ -49,3 +49,3 @@ ): (currentState: S | undefined, a: A, b: B, c: C) => S

export default function<S = any>(
recipe: (this: S, draftState: S, ...extraArgs: any[]) => void,
recipe: (this: S, draftState: S, ...extraArgs: any[]) => void | S,
initialState: S

@@ -57,15 +57,15 @@ ): (currentState: S | undefined, ...extraArgs: any[]) => S

export default function<S = any>(
recipe: (this: S, draftState: S) => void
recipe: (this: S, draftState: S) => void | S
): (currentState: S) => S
// 1 additional argument of type A
export default function<S = any, A = any>(
recipe: (this: S, draftState: S, a: A) => void
recipe: (this: S, draftState: S, a: A) => void | S
): (currentState: S, a: A) => S
// 2 additional arguments of types A and B
export default function<S = any, A = any, B = any>(
recipe: (this: S, draftState: S, a: A, b: B) => void
recipe: (this: S, draftState: S, a: A, b: B) => void | S
): (currentState: S, a: A, b: B) => S
// 3 additional arguments of types A, B and C
export default function<S = any, A = any, B = any, C = any>(
recipe: (this: S, draftState: S, a: A, b: B, c: C) => void
recipe: (this: S, draftState: S, a: A, b: B, c: C) => void | S
): (currentState: S, a: A, b: B, c: C) => S

@@ -76,3 +76,3 @@ // any number of additional arguments, but with loss of type safety

export default function<S = any>(
recipe: (this: S, draftState: S, ...extraArgs: any[]) => void
recipe: (this: S, draftState: S, ...extraArgs: any[]) => void | S
): (currentState: S, ...extraArgs: any[]) => S

@@ -79,0 +79,0 @@ /**

{
"name": "immer",
"version": "1.2.0",
"version": "1.2.1",
"description": "Create your next immutable state by mutating the current one",

@@ -53,3 +53,3 @@ "main": "dist/immer.js",

"deep-freeze": "^0.0.1",
"flow-bin": "^0.65.0",
"flow-bin": "^0.68.0",
"husky": "^0.14.3",

@@ -56,0 +56,0 @@ "immutable": "^3.8.2",

# Immer
[![npm](https://img.shields.io/npm/v/copee.svg)](https://www.npmjs.com/package/immer)
[![npm](https://img.shields.io/npm/v/immer.svg)](https://www.npmjs.com/package/immer)
[![size](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/immer/dist/immer.umd.js?compression=gzip)](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/immer/dist/immer.umd.js)

@@ -19,3 +19,3 @@ [![Build Status](https://travis-ci.org/mweststrate/immer.svg?branch=master)](https://travis-ci.org/mweststrate/immer)

* JSDelivr: `<script src="https://cdn.jsdelivr.net/npm/immer/dist/immer.umd.js"></script>`
---

@@ -204,2 +204,3 @@

})
return
})

@@ -217,11 +218,16 @@ }

const byId = produce((draft, action) => {
switch (action.type) {
case RECEIVE_PRODUCTS:
action.products.forEach(product => {
draft[product.id] = product
})
})
const byId = produce(
(draft, action) => {
switch (action.type) {
case RECEIVE_PRODUCTS:
action.products.forEach(product => {
draft[product.id] = product
})
return
}
},
{
1: { id: 1, name: "product-1" }
}
}, { 1: { id: 1, name: "product-1" } })
)
```

@@ -324,2 +330,3 @@

* [redux-starter-kit](https://github.com/markerikson/redux-starter-kit) _A simple set of tools to make using Redux easier_
* [immer based handleActions](https://gist.github.com/kitze/fb65f527803a93fb2803ce79a792fff8) _Boilerplate free actions for Redux_

@@ -337,3 +344,3 @@ * [redux-box](https://github.com/anish000kumar/redux-box) _Modular and easy-to-grasp redux based state management, with least boilerplate_

```javscript
```javascript
import produce from "immer";

@@ -340,0 +347,0 @@

Sorry, the diff of this file is not supported yet

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