@uxf/core 11.108.0 → 11.111.2

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 CHANGED
@@ -420,7 +420,7 @@ if (inArray(status, statuses)) {
420
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
421
 
422
422
  ```ts
423
- import isEqual from "@uxf/core/utils/is-equal";
423
+ import { isEqual } from "@uxf/core/utils/is-equal";
424
424
 
425
425
  isEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }); /* returns true */
426
426
  isEqual({ a: 1 }, { a: 2 }); /* returns false */
@@ -505,6 +505,23 @@ isNotNil([]); /* returns true */
505
505
  isNotNil("string"); /* returns true */
506
506
  ```
507
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
+
508
525
  ## isPlainObject
509
526
 
510
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/core",
3
- "version": "11.108.0",
3
+ "version": "11.111.2",
4
4
  "description": "UXF Core",
5
5
  "author": "Petr Vejvoda <vejvoda@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/core#readme",
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const deepmerge_1 = require("./deepmerge");
4
+ test("recursively merges two objects", () => {
5
+ const target = { a: 1, b: { x: 10 } };
6
+ const source = { b: { y: 20 }, c: 3 };
7
+ expect((0, deepmerge_1.deepmerge)(target, source)).toEqual({ a: 1, b: { x: 10, y: 20 }, c: 3 });
8
+ });
9
+ test("concatenates arrays", () => {
10
+ expect((0, deepmerge_1.deepmerge)([1, 2], [3, 4])).toEqual([1, 2, 3, 4]);
11
+ });
@@ -1 +1 @@
1
- export {} from "lodash.isequal";
1
+ export { default as isEqual } from "lodash.isequal";
package/utils/is-equal.js CHANGED
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isEqual = void 0;
7
+ var lodash_isequal_1 = require("lodash.isequal");
8
+ Object.defineProperty(exports, "isEqual", { enumerable: true, get: function () { return __importDefault(lodash_isequal_1).default; } });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const is_equal_1 = require("./is-equal");
4
+ test("returns true for deeply equal objects", () => {
5
+ expect((0, is_equal_1.isEqual)({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] })).toBe(true);
6
+ });
7
+ test("returns false for different objects", () => {
8
+ expect((0, is_equal_1.isEqual)({ a: 1 }, { a: 2 })).toBe(false);
9
+ });
@@ -0,0 +1,2 @@
1
+ import { AnyObject, Nullish } from "../types";
2
+ export declare function isNotNilNorEmpty<T extends unknown[] | AnyObject | string>(value: T | Nullish): value is T;
@@ -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
+ });