@uxf/core 11.108.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
CHANGED
|
@@ -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
|
@@ -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
|
+
});
|