You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,11 @@
4
4
5
5
Microdiff is a tiny (currently <1kb), fast, zero dependency object and array comparison library. It is significantly faster than most other deep comparison libraries, and has full TypeScript support.
6
6
7
+
8
+
> 💡 I recommend reading this blog post:
9
+
>
10
+
> **[Building the fastest object and array differ](https://byteofdev.com/posts/microdiff/)** for an explanation of how Microdiff achieves its size and speed.
@@ -12,7 +17,7 @@ Microdiff is a tiny (currently <1kb), fast, zero dependency object and array com
12
17
13
18
- 🚀 More than double the speed of other object diff libraries
14
19
- 📦 Extremely lightweight, <1kb minified
15
-
- 🌎 Supports Deno, Node, the web, and even service workers. Also comes with builtin Typescript types
20
+
- 🌎 Supports Deno, Node, the web, and even service workers. Also comes with built-in Typescript types
16
21
- 🔰 Very easy to use, having just a single `diff()` function
17
22
- 📅 Full support for objects like `new Date()` and `new RegExp()`
18
23
@@ -26,7 +31,7 @@ npm i microdiff
26
31
27
32
If you are using Deno, you can import it from Deno.land with the link `https://deno.land/x/microdiff@VERSION/index.ts` (remember to change `@VERSION` to the version you want to use).
28
33
29
-
After you install it, simply import it and run it on two objects.
34
+
After you install it, import it and run it on two objects.
30
35
31
36
```js
32
37
importdifffrom"microdiff";
@@ -49,15 +54,15 @@ If you are using CommonJS, you can import it like this:
49
54
constdiff=require("microdiff").default;
50
55
```
51
56
52
-
There are three different types of changes.`CREATE`, `REMOVE`, and `CHANGE`.
57
+
There are three different types of changes:`CREATE`, `REMOVE`, and `CHANGE`.
53
58
The `path` property gives a path to the property in the new object (or the old object in the case of `REMOVE`).
54
-
Each element in the paths is a key to the next property a level deeper until you get to the property changed, and it is string or a number, depending on whether the object is an Array or Object (Objects with number keys will still be strings).
59
+
Each element in the paths is a key to the next property a level deeper until you get to the property changed, and it is a string or a number, depending on whether the object is an Array or Object (Objects with number keys will still be strings).
55
60
The `value` property exists in types `CREATE` and `CHANGE`, and it contains the value of the property added/changed/deleted.
56
61
The `oldValue` property exists in the type `CHANGE` and `REMOVE`, and it contains the old value of the property.
57
62
58
63
# Cycles support
59
64
60
-
By default cycles are supported, but if you are sure that the object has no cycles (for example if you are parsing JSON) you can disable cycles using the `cyclesFix` option.
65
+
By default, Microdiff supports cyclical references, but if you are sure that the object has no cycles like parsed JSON, you can disable cycles using the `cyclesFix` option.
0 commit comments