@uxf/core 11.107.0 → 11.110.0
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/README.md +53 -0
- package/package.json +6 -1
- package/utils/deepmerge.d.ts +2 -0
- package/utils/deepmerge.js +8 -0
- package/utils/is-equal.d.ts +1 -0
- package/utils/is-equal.js +2 -0
- package/utils/is-not-nil-nor-empty.d.ts +2 -0
- package/utils/is-not-nil-nor-empty.js +8 -0
- package/utils/is-not-nil-nor-empty.test.d.ts +1 -0
- package/utils/is-not-nil-nor-empty.test.js +7 -0
- package/utils/qs.d.ts +2 -0
- package/utils/qs.js +6 -0
package/README.md
CHANGED
|
@@ -258,6 +258,20 @@ cxa("foo", [1 && "bar", { baz:false, bat:null }, ["hello", ["world"]]], "cya");
|
|
|
258
258
|
//=> "foo bar hello world cya"
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
+
### deepmerge
|
|
262
|
+
|
|
263
|
+
Re-export of the [deepmerge](https://github.com/TehShrike/deepmerge) library. Recursively merges two or more objects and arrays.
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
import { deepmerge } from "@uxf/core/utils/deepmerge";
|
|
267
|
+
|
|
268
|
+
const target = { a: 1, b: { x: 10 } };
|
|
269
|
+
const source = { b: { y: 20 }, c: 3 };
|
|
270
|
+
|
|
271
|
+
deepmerge(target, source);
|
|
272
|
+
/* returns { a: 1, b: { x: 10, y: 20 }, c: 3 } */
|
|
273
|
+
```
|
|
274
|
+
|
|
261
275
|
### deepEqualIgnoringKeyOrder
|
|
262
276
|
|
|
263
277
|
deepEqualIgnoringKeyOrder compares two values for deep equality while ignoring the order of object keys. It serializes values in a stable way, ensuring that objects with the same data but different key orders are treated as equal. Arrays remain order-sensitive, circular references are handled safely, and primitives are compared by value.
|
|
@@ -401,6 +415,17 @@ if (inArray(status, statuses)) {
|
|
|
401
415
|
}
|
|
402
416
|
```
|
|
403
417
|
|
|
418
|
+
## isEqual
|
|
419
|
+
|
|
420
|
+
Re-export of [lodash.isequal](https://lodash.com/docs/#isEqual). Performs a deep comparison between two values to determine if they are equivalent.
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
import isEqual from "@uxf/core/utils/is-equal";
|
|
424
|
+
|
|
425
|
+
isEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }); /* returns true */
|
|
426
|
+
isEqual({ a: 1 }, { a: 2 }); /* returns false */
|
|
427
|
+
```
|
|
428
|
+
|
|
404
429
|
## isEmpty
|
|
405
430
|
|
|
406
431
|
```tsx
|
|
@@ -480,6 +505,23 @@ isNotNil([]); /* returns true */
|
|
|
480
505
|
isNotNil("string"); /* returns true */
|
|
481
506
|
```
|
|
482
507
|
|
|
508
|
+
## isNotNilNorEmpty
|
|
509
|
+
|
|
510
|
+
Type guard that checks if a value is not `null`, not `undefined`, and not empty. Works with strings, arrays, and plain objects.
|
|
511
|
+
|
|
512
|
+
```tsx
|
|
513
|
+
import { isNotNilNorEmpty } from "@uxf/core/utils/is-not-nil-nor-empty";
|
|
514
|
+
|
|
515
|
+
isNotNilNorEmpty("not-empty"); /* returns true */
|
|
516
|
+
isNotNilNorEmpty({ not: "empty" }); /* returns true */
|
|
517
|
+
isNotNilNorEmpty(["1"]); /* returns true */
|
|
518
|
+
isNotNilNorEmpty(""); /* returns false */
|
|
519
|
+
isNotNilNorEmpty([]); /* returns false */
|
|
520
|
+
isNotNilNorEmpty({}); /* returns false */
|
|
521
|
+
isNotNilNorEmpty(null); /* returns false */
|
|
522
|
+
isNotNilNorEmpty(undefined); /* returns false */
|
|
523
|
+
```
|
|
524
|
+
|
|
483
525
|
## isPlainObject
|
|
484
526
|
|
|
485
527
|
Type guard that checks if a value is a plain object. Returns `false` for arrays, `null`, `Date`, `Map`, `Set`, `RegExp`, and other non-plain-object types.
|
|
@@ -589,6 +631,17 @@ t("items", 3); // returns "položky"
|
|
|
589
631
|
t("items", 5); // returns "položek"
|
|
590
632
|
```
|
|
591
633
|
|
|
634
|
+
## qs
|
|
635
|
+
|
|
636
|
+
Re-export of [qs](https://github.com/ljharb/qs). A querystring parsing and stringifying library.
|
|
637
|
+
|
|
638
|
+
```ts
|
|
639
|
+
import { stringify, parse } from "@uxf/core/utils/qs";
|
|
640
|
+
|
|
641
|
+
stringify({ a: "b", c: [1, 2] }); /* returns "a=b&c%5B0%5D=1&c%5B1%5D=2" */
|
|
642
|
+
parse("a=b&c=1"); /* returns { a: "b", c: "1" } */
|
|
643
|
+
```
|
|
644
|
+
|
|
592
645
|
## slugify
|
|
593
646
|
|
|
594
647
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.110.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "Petr Vejvoda <vejvoda@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/core#readme",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@types/lodash.isequal": "4.5.8",
|
|
24
|
+
"@types/qs": "6.15.0",
|
|
25
|
+
"deepmerge": "4.3.1",
|
|
26
|
+
"lodash.isequal": "4.5.0",
|
|
27
|
+
"qs": "6.15.0",
|
|
23
28
|
"ts-pattern": "5.9.0"
|
|
24
29
|
},
|
|
25
30
|
"bugs": {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deepmerge = void 0;
|
|
7
|
+
var deepmerge_1 = require("deepmerge");
|
|
8
|
+
Object.defineProperty(exports, "deepmerge", { enumerable: true, get: function () { return __importDefault(deepmerge_1).default; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {} from "lodash.isequal";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNotNilNorEmpty = isNotNilNorEmpty;
|
|
4
|
+
const is_empty_1 = require("./is-empty");
|
|
5
|
+
const is_nil_1 = require("./is-nil");
|
|
6
|
+
function isNotNilNorEmpty(value) {
|
|
7
|
+
return !(0, is_nil_1.isNil)(value) && !(0, is_empty_1.isEmpty)(value);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const is_not_nil_nor_empty_1 = require("./is-not-nil-nor-empty");
|
|
4
|
+
test("isNotNilNorEmpty", () => {
|
|
5
|
+
[["1"], { not: "empty" }, "not-empty"].map((value) => expect((0, is_not_nil_nor_empty_1.isNotNilNorEmpty)(value)).toBeTruthy());
|
|
6
|
+
[[], {}, "", null, undefined].map((value) => expect((0, is_not_nil_nor_empty_1.isNotNilNorEmpty)(value)).toBeFalsy());
|
|
7
|
+
});
|
package/utils/qs.d.ts
ADDED
package/utils/qs.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringify = exports.parse = void 0;
|
|
4
|
+
var qs_1 = require("qs");
|
|
5
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return qs_1.parse; } });
|
|
6
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return qs_1.stringify; } });
|