fix grammatical errors and typos
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Mudassar045 · committed by Mudassar045 · parent 0a57561 · Browse files · 5 files·+7 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+7 added−7 removed
- tests:+2 added−2 removed
- other:+5 added−5 removed
Provenance
- Commit
21e76c2- Tree
75ae023- Author
Mudassar045 <mudassaralics007@gmail.com>- Committer
Mudassar045 <mudassaralics007@gmail.com>- Parent
0a57561
5 files changed+7 added−7 removed
modified:__tests__/readme.js+2 added-2 removed
91 unmodified lines92 tokenSet: new Set()93 }94 95 const nextState = produce(state, draft => {96- draft.title = draft.title.toUpperCase() // let immer do it's job96+ draft.title = draft.title.toUpperCase() // let immer do its job97 // don't use the operations onSet, as that mutates the instance!98 // draft.tokenSet.add("c1342")99 100 // instead: clone the set (once!)18 unmodified lines119 120 const nextState = produce(state, draft => {121 const newUsers = new Map(draft.users)122 // mutate the new map and set a _new_ user object123- // but leverage produce again to deeply update it's contents123+ // but leverage produce again to deeply update its contents124 newUsers.set(125 "michel",126 produce(draft.users.get("michel"), draft => {127 draft.name = "michel"78 unmodified linesmodified:_site/readme/index.html+1 added-1 removed
1116 unmodified lines1117 to pass them to components, over the network etc... (And there is also the1118 upfront cost of converting data received from e.g. the server to immutable1119 JS)1120 </li>1121- <li>Generating patches doesn't significantly slow immer down</li>1121+ <li>Generating patches doesn't significantly slow down immer</li>1122 <li>1123 The ES5 fallback implementation is roughly twice as slow as the proxy1124 implementation, in some cases worse.1125 </li>65 unmodified linesmodified:docs/api.md+2 added-2 removed
9 unmodified lines101112131414151617181920212223232425262713 unmodified lines9 unmodified lines| `applyPatches` | Given a base state or draft, and a set of patches, applies the patches | [Patches](patches.md) || `createDraft` | Given a base state, creates a mutable draft for which any modifications will be recorded | [Async](async.md) || `Draft<T>` | Exposed TypeScript type to convert an immutable type to a mutable type | [TypeScript](typescript.md) || `finishDraft` | Given an draft created using `createDraft`, seals the draft and produces and returns the next immutable state that captures all the changes | [Async](async.md) || `Immer` | constructor that can be used to create a second "immer" instance (exposing all APIs listed in this instance), that doesn't share it's settings with global instance. Can also be used to attach further hooks that are triggered during object finalization, such as `onAssign`, `onDelete` and `onCopy`. | [See source](https://github.com/immerjs/immer/blob/cb1c6dd8a33073aaa0a4d881c94ec7ab1c1be7f6/src/immer.d.ts#L224-L233) || `Immer` | constructor that can be used to create a second "immer" instance (exposing all APIs listed in this instance), that doesn't share its settings with global instance. Can also be used to attach further hooks that are triggered during object finalization, such as `onAssign`, `onDelete` and `onCopy`. | [See source](https://github.com/immerjs/immer/blob/cb1c6dd8a33073aaa0a4d881c94ec7ab1c1be7f6/src/immer.d.ts#L224-L233) || `immerable` | Symbol that can be added to a constructor or prototype, to indicate that Immer should treat the class as something that can be safely drafted | [Classes](complex-objects.md) || `Immutable<T>` | Exposed TypeScript type to convert mutable types to immutable types | || `isDraft` | Returns true if the given object is a draft object | || `isDraftable` | Returns true if Immer is capable of turning this object into a draft. Which is true for: arrays, objects without prototype, objects with `Object` as their prototype, objects that have the `immerable` symbol on their constructor or prototype | || `nothing` | Value that can be returned from a recipe, to indicate that the value `undefined` should be produced | [Return](return.md) || `original` | Given a draft object (doesn't have to be a tree root), returns the the original object at the same path in the original state tree, if present | [Original](original.md) || `Patch` | Exposed TypeScript type, describes the shape of an (inverse) patch object | [Patches](patches.md) || `produce` | The core API of Immer, also exposed as the `default` export | [Produce](produce.md) || `setAutoFreeze` | Enables / disableds automatic freezing of the trees produces. By default enabled in development builds | [Freezing](freezing.md) || `setAutoFreeze` | Enables / disables automatic freezing of the trees produces. By default enabled in development builds | [Freezing](freezing.md) || `setUseProxies` | Can be used to disable or force the use of `Proxy` objects. Useful when filing bug reports. | |
## Importing immer
13 unmodified linesmodified:docs/performance.md+1 added-1 removed
15 unmodified lines1617181920202115 unmodified linesMost important observation:
- Immer with proxies is roughly speaking twice to three times slower as a handwritten reducer (the above test case is worst case, see `yarn test:perf` for more tests). This is in practice negligible.- Immer is roughly as fast as ImmutableJS. However, the _immutableJS + toJS_ makes clear the cost that often needs to be paid later; converting the immutableJS objects back to plain objects, to be able to pass them to components, over the network etc... (And there is also the upfront cost of converting data received from e.g. the server to immutable JS)- Generating patches doesn't significantly slow immer down- Generating patches doesn't significantly slow down immer- The ES5 fallback implementation is roughly twice as slow as the proxy implementation, in some cases worse.modified:docs/support.md+1 added-1 removed
5 unmodified lines678910105 unmodified lines<div id="codefund"><!-- fallback content --></div>
Immer currently has 350.000 dependents on GitHub, and has almost 10.000.000 downloads per month. However, only the first 2 days of development has been sponsored (by Mendix), and all the development and maintenance after that has been a labor of love.
If you are enjoying Immer, and you are grateful for the package, or want to ensure it's longevity, consider sponsoring the open collective on https://opencollective.com/immer or make a one time donation using [PayPal](https://www.paypal.me/michelweststrate).If you are enjoying Immer, and you are grateful for the package, or want to ensure its longevity, consider sponsoring the open collective on https://opencollective.com/immer or make a one time donation using [PayPal](https://www.paypal.me/michelweststrate).