@tamtamchik/json-deep-sort 0.1.1 → 1.0.1

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.
@@ -0,0 +1,23 @@
1
+ version: 2.1
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: cimg/node:20.2.0
6
+ steps:
7
+ - checkout
8
+ - restore_cache:
9
+ keys:
10
+ - v1-dependencies-{{ checksum "package-lock.json" }}
11
+ - v1-dependencies-
12
+ - run: npm ci
13
+ - run: npm test
14
+ - run: npm run coverage
15
+ - save_cache:
16
+ paths:
17
+ - node_modules
18
+ key: v1-dependencies-{{ checksum "package-lock.json" }}
19
+ workflows:
20
+ version: 2
21
+ build_and_test:
22
+ jobs:
23
+ - build
package/README.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # JSON Deep Sort
2
2
 
3
- ![npm](https://img.shields.io/npm/v/json-deep-sort)
4
- ![license](https://img.shields.io/npm/l/json-deep-sort)
3
+ [![Buy Me A Coffee][ico-coffee]][link-coffee]
4
+ [![Latest Version on NPM][ico-version]][link-npm]
5
+ [![CircleCI][ico-circleci]][link-circleci]
6
+ [![Software License][ico-license]](LICENSE)
7
+ [![Total Downloads][ico-downloads]][link-downloads]
5
8
 
6
9
  JSON Deep Sort is a comprehensive package that provides flexible sorting of JSON objects by keys. This
7
10
  TypeScript-written package can handle deeply nested objects and arrays, and offers both synchronous and asynchronous
@@ -19,13 +22,13 @@ operations.
19
22
  Using npm:
20
23
 
21
24
  ```shell
22
- npm install json-deep-sort
25
+ npm install @tamtamchik/json-deep-sort
23
26
  ```
24
27
 
25
28
  Using yarn:
26
29
 
27
30
  ```shell
28
- yarn add json-deep-sort
31
+ yarn add @tamtamchik/json-deep-sort
29
32
  ```
30
33
 
31
34
  ## Usage
@@ -49,8 +52,9 @@ let data = {
49
52
  b: 'b'
50
53
  }
51
54
  };
55
+
52
56
  let sortedData = sort(data, true);
53
- console.log(sortedData); // { a: 'a', b: 'b', c: { a: 'a', b: 'b', c: 'c', d: 'd' } }
57
+ // { a: 'a', b: 'b', c: { a: 'a', b: 'b', c: 'c', d: 'd' } }
54
58
  ```
55
59
 
56
60
  ## Contributing
@@ -60,3 +64,14 @@ Pull requests are welcome. For major changes, please open an issue first to disc
60
64
  ## License
61
65
 
62
66
  JSON Deep Sort is [MIT licensed](./LICENSE).
67
+
68
+ [ico-coffee]: https://img.shields.io/badge/Buy%20Me%20A-Coffee-%236F4E37.svg?style=flat-square
69
+ [ico-version]: https://img.shields.io/npm/v/@tamtamchik/json-deep-sort.svg?style=flat-square
70
+ [ico-license]: https://img.shields.io/npm/l/@tamtamchik/json-deep-sort.svg?style=flat-square
71
+ [ico-downloads]: https://img.shields.io/npm/dt/@tamtamchik/json-deep-sort.svg?style=flat-square
72
+ [ico-circleci]: https://img.shields.io/circleci/build/github/tamtamchik/json-deep-sort.svg?style=flat-square
73
+
74
+ [link-coffee]: https://www.buymeacoffee.com/tamtamchik
75
+ [link-npm]: https://www.npmjs.com/package/@tamtamchik/json-deep-sort
76
+ [link-downloads]: https://www.npmjs.com/package/@tamtamchik/json-deep-sort
77
+ [link-circleci]: https://app.circleci.com/pipelines/github/tamtamchik/json-deep-sort?branch=main
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Function to sort JSON data.
3
+ * @param {any} data - The data to be sorted.
4
+ * @param {boolean} [asc=true] - Whether to sort in ascending order.
5
+ * @returns {any} The sorted data.
6
+ * @throws {Error} If the data is not an object or array.
7
+ */
8
+ export declare function sort(data: any, asc?: boolean): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Function to sort JSON data.
3
+ * @param {any} data - The data to be sorted.
4
+ * @param {boolean} [asc=true] - Whether to sort in ascending order.
5
+ * @returns {any} The sorted data.
6
+ * @throws {Error} If the data is not an object or array.
7
+ */
8
+ export declare function sort(data: any, asc?: boolean): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamtamchik/json-deep-sort",
3
- "version": "0.1.1",
3
+ "version": "1.0.1",
4
4
  "description": "A comprehensive utility for sorting JSON objects by keys.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -53,6 +53,7 @@
53
53
  "build": "npm run build:cjs && npm run build:esm",
54
54
  "dev": "tsc --watch",
55
55
  "prepare": "npm run build",
56
- "test": "jest"
56
+ "test": "jest",
57
+ "coverage": "jest --coverage"
57
58
  }
58
59
  }