fixed conflicts
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Gregory Assasie · committed by Gregory Assasie · parents 347259d, 4d4b1c9 · Browse files · 4 files·+21 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+21 added−11 removed
- other:+21 added−11 removed
Provenance
- Commit
64b2276- Tree
7bc37b3- Author
Gregory Assasie <gregjarvez@gmail.com>- Committer
Gregory Assasie <gregjarvez@gmail.com>- Parent 1
347259d- Parent 2
4d4b1c9
4 files changed+21 added−11 removed
modified:changelog.md+8 added
12345678910111213148 unmodified lines# Changelog
### 0.1.2 (2-1-2018)
* Fixed issue where trailing commas could break consumers. Fixes [#21](https://github.com/mweststrate/immer/pull/21).
### 0.1.1 (2-1-2018)
* Fixed issue where TypeScript typings were not correctly exposed. Fixes [#18](https://github.com/mweststrate/immer/issue/18).
### 0.1.0 (1-1-2018)
* Fixed `immer` function export, it is now properly exposed as the `default` export. So `import immer from "immer"`. See [#15](https://github.com/mweststrate/immer/pull/15)* Immer now automatically freezes any state modifications made. Turn this is using `setAutoFreeze(false)` for more efficiency in production builds. See [#15](https://github.com/mweststrate/immer/pull/15)8 unmodified linesmodified:immer.js+4 added-4 removed
59 unmodified lines60 deleteProperty(target, property) {61 const copy = getOrCreateCopy(target)62 delete copy[property]63 return true64- },64+ }65 }66 67 // creates a copy for a base object if there ain't one68 function getOrCreateCopy(base) {31 unmodified lines100 : Object.assign({}, base)101 Object.defineProperty(proxyTarget, CLONE_TARGET, {102 enumerable: false,103 value: base,104- configurable: true,104+ configurable: true105 })106 } else {107 proxyTarget = base108 }57 unmodified lines166 const maybeVoidReturn = thunk(rootClone)167 //values either than undefined will trigger warning;168 !Object.is(maybeVoidReturn, undefined) &&169 console.warn(170- `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`,170+ `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`171 )172 // console.log(`proxies: ${revocableProxies.size}, copies: ${copies.size}`)173 // revoke all proxies174 revoke(revocableProxies)41 unmodified lines216 autoFreeze = enableAutoFreeze217 }218 219 Object.defineProperty(exports, "__esModule", {220- value: true,220+ value: true221 })222 module.exports.default = immer223 module.exports.setAutoFreeze = setAutoFreezemodified:package.json+3 added-2 removed
1233456718 unmodified lines262728293030313233343516 unmodified lines{ "name": "immer", "version": "0.1.0", "version": "0.1.2", "description": "Create your next immutable state by mutating the current one", "main": "immer.js", "types": "./index.d.ts", "scripts": {18 unmodified lines "url": "https://github.com/mweststrate/immer/issues" }, "homepage": "https://github.com/mweststrate/immer#readme", "files": [ "immer.js" "immer.js", "index.d.ts" ], "devDependencies": { "@types/jest": "^22.0.0", "babel-core": "^6.26.0",16 unmodified linesmodified:readme.md+6 added-5 removed
3 unmodified lines4 5 ---6 7 Immer (German for: always) is a tiny package that allows you to work with immutable state in a more convenient way.8-It is based on [_copy-on-write_](https://en.wikipedia.org/wiki/Copy-on-write) mechanism.8+It is based on the [_copy-on-write_](https://en.wikipedia.org/wiki/Copy-on-write) mechanism.9 10-The basic idea is that, you will apply all your changes to a _draftState_, which is a proxy of the _currentState_ and once all your mutations are completed, immer will produce the _nextState_ based on the mutations to the draft state. This means that you can interact with your data by simply modifying it, while keeping all the benefits of immutable data.10+The basic idea is that you will apply all your changes to a temporarily _draftState_, which is a proxy of the _currentState_.11+Once all your mutations are completed, immer will produce the _nextState_ based on the mutations to the draft state.12+This means that you can interact with your data by simply modifying it, while keeping all the benefits of immutable data.13 12-<center>13-14 15 16 Using immer is like having a personal assistant; he takes a letter (the current state), and gives you a copy (draft) to jot changes onto. Once you are done, the assistant will take your draft and produce the real immutable, final letter for you (the next state).17-</center>17 18+A mindful reader might notice that this is quite similar to `withMutations` of ImmutableJS. It is indeed, but generalized and applicable to plain, native JavaScript data structures (arrays and objects) without further needing any library.19+20 ## API21 22 The immer package exposes a single function:23 160 unmodified lines