@open-pioneer/core 4.7.0-dev.20260623135435 → 4.7.0-dev.20260624141040
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.
- package/CHANGELOG.md +14 -1
- package/README.md +18 -0
- package/equal.d.ts +43 -0
- package/equal.js +11 -0
- package/equal.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# @open-pioneer/core
|
|
2
2
|
|
|
3
|
-
## 4.7.0-dev.
|
|
3
|
+
## 4.7.0-dev.20260624141040
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- 7c7e6d1: Add shallowEqual and deepEqual helper function to compare two objects.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { shallowEqual, deepEqual } from "@open-pioneer/core";
|
|
13
|
+
|
|
14
|
+
shallowEqual({ a: 1 }, { a: 1 }); // true
|
|
15
|
+
shallowEqual({ a: { x: 1 } }, { a: { x: 1 } }); // false
|
|
16
|
+
deepEqual({ a: { x: 1 } }, { a: { x: 1 } }); // true
|
|
17
|
+
deepEqual([1, [2, 3]], [1, [2, 3]]); // true
|
|
18
|
+
```
|
|
19
|
+
|
|
7
20
|
- e433296: Update Chakra UI to 3.36.0
|
|
8
21
|
|
|
9
22
|
## 4.6.0
|
package/README.md
CHANGED
|
@@ -109,6 +109,24 @@ function someFunctionName() {
|
|
|
109
109
|
|
|
110
110
|
The package exports the `EventEmitter` class that supports emitting and subscribing to user defined events.
|
|
111
111
|
|
|
112
|
+
### Equality functions
|
|
113
|
+
|
|
114
|
+
Use `shallowEqual` and `deepEqual` to compare two generic objects.
|
|
115
|
+
Note that the functions are intended to be used with _plain old data_ (i.e. mostly JSON).
|
|
116
|
+
|
|
117
|
+
They do _not_ support cycles.
|
|
118
|
+
|
|
119
|
+
Examples:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { shallowEqual, deepEqual } from "@open-pioneer/core";
|
|
123
|
+
|
|
124
|
+
shallowEqual({ a: 1 }, { a: 1 }); // true
|
|
125
|
+
shallowEqual({ a: { x: 1 } }, { a: { x: 1 } }); // false
|
|
126
|
+
deepEqual({ a: { x: 1 } }, { a: { x: 1 } }); // true
|
|
127
|
+
deepEqual([1, [2, 3]], [1, [2, 3]]); // true
|
|
128
|
+
```
|
|
129
|
+
|
|
112
130
|
## License
|
|
113
131
|
|
|
114
132
|
Apache-2.0 (see `LICENSE` file)
|
package/equal.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two values using shallow equality.
|
|
3
|
+
*
|
|
4
|
+
* This is useful when you want to detect changes on the top level without
|
|
5
|
+
* recursively traversing nested objects.
|
|
6
|
+
*
|
|
7
|
+
* Primitive values are compared by value.
|
|
8
|
+
* Arrays and objects are compared by their own enumerable keys, but nested values are only compared
|
|
9
|
+
* by reference. Circular objects are not supported.
|
|
10
|
+
*
|
|
11
|
+
* > NOTE: This function is intended to be used with _plain old data_ inputs (i.e. mostly JSON).
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* shallowEqual({ a: 1 }, { a: 1 }); // true
|
|
17
|
+
* shallowEqual({ a: { x: 1 } }, { a: { x: 1 } }); // false
|
|
18
|
+
* shallowEqual([1, 2], [1, 2]); // true
|
|
19
|
+
* shallowEqual(() => 1, () => 1); // false
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function shallowEqual(a: unknown, b: unknown): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Compares two values using deep equality.
|
|
26
|
+
*
|
|
27
|
+
* This is useful when you need to verify structural equality of nested data.
|
|
28
|
+
*
|
|
29
|
+
* Primitive values are compared by value.
|
|
30
|
+
* Arrays and objects are traversed recursively, so nested values must also be equal.
|
|
31
|
+
* Functions are compared by reference. Circular objects are not supported.
|
|
32
|
+
*
|
|
33
|
+
* > NOTE: This function is intended to be used with _plain old data_ inputs (i.e. mostly JSON).
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* deepEqual({ a: { x: 1 } }, { a: { x: 1 } }); // true
|
|
39
|
+
* deepEqual([1, [2, 3]], [1, [2, 3]]); // true
|
|
40
|
+
* deepEqual(() => 1, () => 1); // false
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
package/equal.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { deepEqual as deepEqual$1, shallowEqual as shallowEqual$1 } from 'fast-equals';
|
|
2
|
+
|
|
3
|
+
function shallowEqual(a, b) {
|
|
4
|
+
return shallowEqual$1(a, b);
|
|
5
|
+
}
|
|
6
|
+
function deepEqual(a, b) {
|
|
7
|
+
return deepEqual$1(a, b);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { deepEqual, shallowEqual };
|
|
11
|
+
//# sourceMappingURL=equal.js.map
|
package/equal.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equal.js","sources":["equal.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { deepEqual as deepEqualImpl, shallowEqual as shallowEqualImpl } from \"fast-equals\";\n\n/**\n * Compares two values using shallow equality.\n *\n * This is useful when you want to detect changes on the top level without\n * recursively traversing nested objects.\n *\n * Primitive values are compared by value.\n * Arrays and objects are compared by their own enumerable keys, but nested values are only compared\n * by reference. Circular objects are not supported.\n *\n * > NOTE: This function is intended to be used with _plain old data_ inputs (i.e. mostly JSON).\n *\n * Examples:\n *\n * ```ts\n * shallowEqual({ a: 1 }, { a: 1 }); // true\n * shallowEqual({ a: { x: 1 } }, { a: { x: 1 } }); // false\n * shallowEqual([1, 2], [1, 2]); // true\n * shallowEqual(() => 1, () => 1); // false\n *\n * ```\n */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n return shallowEqualImpl(a, b);\n}\n\n/**\n * Compares two values using deep equality.\n *\n * This is useful when you need to verify structural equality of nested data.\n *\n * Primitive values are compared by value.\n * Arrays and objects are traversed recursively, so nested values must also be equal.\n * Functions are compared by reference. Circular objects are not supported.\n *\n * > NOTE: This function is intended to be used with _plain old data_ inputs (i.e. mostly JSON).\n *\n * Examples:\n *\n * ```ts\n * deepEqual({ a: { x: 1 } }, { a: { x: 1 } }); // true\n * deepEqual([1, [2, 3]], [1, [2, 3]]); // true\n * deepEqual(() => 1, () => 1); // false\n * ```\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n return deepEqualImpl(a, b);\n}\n"],"names":["shallowEqualImpl","deepEqualImpl"],"mappings":";;AA0BO,SAAS,YAAA,CAAa,GAAY,CAAA,EAAqB;AAC1D,EAAA,OAAOA,cAAA,CAAiB,GAAG,CAAC,CAAA;AAChC;AAqBO,SAAS,SAAA,CAAU,GAAY,CAAA,EAAqB;AACvD,EAAA,OAAOC,WAAA,CAAc,GAAG,CAAC,CAAA;AAC7B;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { deprecated, type DeprecatedOptions } from "./deprecated";
|
|
2
2
|
export { createAbortError, Error, getErrorChain, isAbortError, rethrowAbortError, throwAbortError } from "./error";
|
|
3
|
+
export { deepEqual, shallowEqual } from "./equal";
|
|
3
4
|
export { EventEmitter, type EventNames, type EventSource } from "./events";
|
|
4
5
|
export { createLogger, type Logger, type LogLevel, type LogMethod } from "./Logger";
|
|
5
6
|
export { NumberParser } from "./NumberParser";
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { deprecated } from './deprecated.js';
|
|
2
2
|
export { Error, createAbortError, getErrorChain, isAbortError, rethrowAbortError, throwAbortError } from './error.js';
|
|
3
|
+
export { deepEqual, shallowEqual } from './equal.js';
|
|
3
4
|
export { EventEmitter } from './events.js';
|
|
4
5
|
export { createLogger } from './Logger.js';
|
|
5
6
|
export { NumberParser } from './NumberParser.js';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/core",
|
|
4
|
-
"version": "4.7.0-dev.
|
|
4
|
+
"version": "4.7.0-dev.20260624141040",
|
|
5
5
|
"description": "Contains basic utility functions and classes used by the @open-pioneer project.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"directory": "src/packages/core"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@conterra/reactivity-events": "^0.8.6"
|
|
17
|
+
"@conterra/reactivity-events": "^0.8.6",
|
|
18
|
+
"fast-equals": "^6.0.0"
|
|
18
19
|
},
|
|
19
20
|
"exports": {
|
|
20
21
|
"./package.json": "./package.json",
|