Skip to content

Commit

Permalink
Merge branch 'master' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Oct 23, 2019
2 parents ae80361 + 732fb19 commit 741e941
Show file tree
Hide file tree
Showing 66 changed files with 10,449 additions and 1,558 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/node_modules
*.log
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
open_collective: immer
custom: https://www.paypal.me/michelweststrate
patreon: mweststrate
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: 🐛 Bug report
labels: "bug"
labels:
about: Create a report to help us improve
---

Expand All @@ -22,6 +22,6 @@ Please provide either a [CodeSandbox demo](https://codesandbox.io/s/82zqr6n3kj)

## Environment

- **Immer version:**
- [ ] Occurs with `setUseProxies(true)`
- [ ] Occurs with `setUseProxies(false)` (ES5 only)
- **Immer version:**
- [ ] Occurs with `setUseProxies(true)`
- [ ] Occurs with `setUseProxies(false)` (ES5 only)
42 changes: 21 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
language: node_js
node_js:
- "8"
- "10"
# - "node"
- "8"
- "10"
# - "node"
env:
- NODE_ENV=TEST
- NODE_ENV=TEST
cache:
yarn: true
directories:
- "node_modules"
yarn: true
directories:
- "node_modules"
before_script:
- yarn global add if-node-version
- yarn global add if-node-version
script:
- yarn build || travis_terminate 1
- if-node-version 10 || { yarn test && travis_terminate 0; }
- yarn coveralls
- yarn test:flow
- yarn test:dts
- yarn build || travis_terminate 1
- if-node-version 10 || { yarn test && travis_terminate 0; }
- yarn coveralls
- yarn test:flow
- yarn test:dts
jobs:
include:
- stage: deploy
if: branch == master && !fork
node_js: "8.9.1" # pre-installed version
script:
- yarn build
- yarn global add semantic-release@^15
- semantic-release
include:
- stage: deploy
if: branch == master && !fork
node_js: "8.12.0" # pre-installed version
script:
- yarn build
- yarn global add semantic-release@^15
- semantic-release
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:8.11.4

WORKDIR /app/website

EXPOSE 3000 35729
COPY ./docs /app/docs
COPY ./website /app/website
RUN yarn install

CMD ["yarn", "start"]
26 changes: 25 additions & 1 deletion __tests__/curry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict"
import produce, {setUseProxies} from "../src/index"
import produce, {setUseProxies, produceWithPatches} from "../src/index"

runTests("proxy", true)
runTests("es5", false)
Expand Down Expand Up @@ -69,4 +69,28 @@ function runTests(name, useProxies) {
expect(spread(base, {y: 1})).toBe(base)
})
})

it("support currying for produceWithPatches", () => {
const increment = produceWithPatches((draft, delta) => {
draft.x += delta
})

expect(increment({x: 5}, 2)).toEqual([
{x: 7},
[
{
op: "replace",
path: ["x"],
value: 7
}
],
[
{
op: "replace",
path: ["x"],
value: 5
}
]
])
})
}
Loading

0 comments on commit 741e941

Please sign in to comment.