json-diff-ts 3.0.0-beta.5 → 3.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +16 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -10,12 +10,26 @@ Another significant feature of this library is its ability to transform changese
10
10
 
11
11
  This library is particularly valuable for applications where tracking changes in JSON data is crucial. It simplifies the process of comparing JSON objects and applying changes. The support for key-based array identification can be especially useful in complex JSON structures where tracking by index is not efficient or intuitive. JSONPath support further enhances its capabilities by allowing precise targeting of specific parts in a JSON document, making it a versatile tool for handling JSON data.
12
12
 
13
+ Starting with version 3, `json-diff-ts` now supports both ECMAScript Modules and CommonJS. This makes the library more versatile and compatible with various JavaScript environments. Whether you're working in a modern project that uses ES modules, or a Node.js project that uses CommonJS, you can now use `json-diff-ts` seamlessly.
14
+
13
15
  ## Installation
14
16
 
15
17
  ```sh
16
18
  npm install json-diff-ts
17
19
  ```
18
20
 
21
+ In TypeScript or ES Modules, you can import the `diff` function like this:
22
+
23
+ ```typescript
24
+ import { diff } from 'json-diff-ts';
25
+ ```
26
+
27
+ In CommonJS, you can import the diff function like this:
28
+
29
+ ```javascript
30
+ const { diff } = require('json-diff-ts');
31
+ ```
32
+
19
33
  ## Capabilities
20
34
 
21
35
  ### `diff`
@@ -24,7 +38,7 @@ Generates a difference set for JSON objects. When comparing arrays, if a specifi
24
38
 
25
39
  #### Examples using Star Wars data:
26
40
 
27
- ```javascript
41
+ ```typescript
28
42
  import { diff } from 'json-diff-ts';
29
43
 
30
44
  const oldData = {
@@ -251,7 +265,7 @@ Reach out to the maintainer via LinkedIn or Twitter:
251
265
  Discover more about the company behind this project: [hololux](https://hololux.com)
252
266
 
253
267
  ## Release Notes
254
- - **v3.0.0:** Supports CommonJS and ECMAScript Modules
268
+ - **v3.0.0:** Supports CommonJS and ECMAScript Modules. Dependency to lodash-es was replaced with lodash to support both ECMAScript and CommonJS.
255
269
  - **v2.2.0:** Fix lodash-es decependency, exclude keys, compare string arrays by value
256
270
  - **v2.1.0:** Resolves a problem related to JSON Path filters by replacing the single equal sign (=) with a double equal sign (==). This update maintains compatibility with existing flat changes. Allows to use either '' or '.' as root in the path.
257
271
  - **v2.0.0:** json-diff-ts has been upgraded to an ECMAScript module! This major update brings optimizations and enhanced documentation. Additionally, a previously existing issue where all paths were treated as regex has been fixed. In this new version, you'll need to use a Map instead of a Record for regex paths. Please note that this is a breaking change if you were using regex paths in the previous versions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-diff-ts",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.8",
4
4
  "description": "A JSON diff tool for JavaScript written in TypeScript.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -50,6 +50,6 @@
50
50
  "typescript": "^5.3.2"
51
51
  },
52
52
  "dependencies": {
53
- "lodash": "^4.17.21"
53
+ "lodash": "4.x"
54
54
  }
55
55
  }