Skip to content

Commit

Permalink
Merge pull request #59 from /issues/58-mention-max_safe_integer
Browse files Browse the repository at this point in the history
Add note about ignoring changes above MAX_SAFE_INTEGER
  • Loading branch information
tomalec authored Sep 6, 2019
2 parents 27ea090 + f3bacef commit 2b9c56d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ See the [ECMAScript spec](http://www.ecma-international.org/ecma-262/6.0/index.h

3. **Generated patches are not immutable**. The patches generated by JSONPatcherProxy contain reference to the profixied object as the patch `value`. You should either serialize the patch to JSON immediately or deep clone the value it if you want to process it later. If you don't do that, you run the risk that reading the patch will contain changes added after the patch was generated.

4. **JSONPatcherProxy might not generate patches for changes of integers above `Number.MAX_SAFE_INTEGER`,
or any other changes beyond the precision of JavaScript double-precision floating-point**. To reduce
patch generation noise, JSONPatcherProxy compares if the new value is the same (`===`) as the previous one. If so, then no patch is generated. Therefore, a change from `Number.MAX_SAFE_INTEGER + 1` to
`Number.MAX_SAFE_INTEGER + 2`, or from `0.02` to `0.020000000000000001` will not be effectively observed.

## Specs/tests

#### In browser
Expand Down

0 comments on commit 2b9c56d

Please sign in to comment.