@tb-dev/utils 3.0.2 → 3.0.3
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/dist/index.cjs +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/nil/index.d.ts +1 -0
- package/dist/nil/is-nil.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,10 @@ const float = /^\d+(?:\.(\d+))?$/;
|
|
|
7
7
|
const regex = {
|
|
8
8
|
float
|
|
9
9
|
};
|
|
10
|
+
function isNil(value) {
|
|
11
|
+
return value === void 0 || value === null;
|
|
12
|
+
}
|
|
13
|
+
const isNullish = isNil;
|
|
10
14
|
function upsert(array, item, predicate) {
|
|
11
15
|
const index = array.findIndex(predicate ?? ((it) => it === item));
|
|
12
16
|
if (index === -1) {
|
|
@@ -81,9 +85,6 @@ function isEmpty(value) {
|
|
|
81
85
|
}
|
|
82
86
|
return false;
|
|
83
87
|
}
|
|
84
|
-
function isNullish(value) {
|
|
85
|
-
return value === void 0 || value === null;
|
|
86
|
-
}
|
|
87
88
|
const noop = () => {
|
|
88
89
|
};
|
|
89
90
|
function toPixel(value) {
|
|
@@ -95,6 +96,7 @@ function toPixel(value) {
|
|
|
95
96
|
exports.PromiseSet = PromiseSet;
|
|
96
97
|
exports.flushPromises = flushPromises;
|
|
97
98
|
exports.isEmpty = isEmpty;
|
|
99
|
+
exports.isNil = isNil;
|
|
98
100
|
exports.isNullish = isNullish;
|
|
99
101
|
exports.noop = noop;
|
|
100
102
|
exports.panic = panic;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './nil';
|
|
1
2
|
export * from './array';
|
|
2
3
|
export * from './panic';
|
|
3
4
|
export * from './regex';
|
|
@@ -14,7 +15,6 @@ export * from './promise';
|
|
|
14
15
|
* Any other value is considered empty only if it is nullish.
|
|
15
16
|
*/
|
|
16
17
|
export declare function isEmpty(value?: unknown): boolean;
|
|
17
|
-
export declare function isNullish(value: unknown): value is null | undefined;
|
|
18
18
|
export declare const noop: () => void;
|
|
19
19
|
/** Adds the pixel unit to a value. */
|
|
20
20
|
export declare function toPixel(value: string | number): string;
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ const float = /^\d+(?:\.(\d+))?$/;
|
|
|
5
5
|
const regex = {
|
|
6
6
|
float
|
|
7
7
|
};
|
|
8
|
+
function isNil(value) {
|
|
9
|
+
return value === void 0 || value === null;
|
|
10
|
+
}
|
|
11
|
+
const isNullish = isNil;
|
|
8
12
|
function upsert(array, item, predicate) {
|
|
9
13
|
const index = array.findIndex(predicate ?? ((it) => it === item));
|
|
10
14
|
if (index === -1) {
|
|
@@ -79,9 +83,6 @@ function isEmpty(value) {
|
|
|
79
83
|
}
|
|
80
84
|
return false;
|
|
81
85
|
}
|
|
82
|
-
function isNullish(value) {
|
|
83
|
-
return value === void 0 || value === null;
|
|
84
|
-
}
|
|
85
86
|
const noop = () => {
|
|
86
87
|
};
|
|
87
88
|
function toPixel(value) {
|
|
@@ -94,6 +95,7 @@ export {
|
|
|
94
95
|
PromiseSet,
|
|
95
96
|
flushPromises,
|
|
96
97
|
isEmpty,
|
|
98
|
+
isNil,
|
|
97
99
|
isNullish,
|
|
98
100
|
noop,
|
|
99
101
|
panic,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isNil, isNullish } from './is-nil';
|