@beecode/msh-util 1.1.0 → 1.2.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/lib/array-util.d.ts +13 -3
- package/lib/array-util.d.ts.map +1 -1
- package/lib/array-util.js +15 -3
- package/lib/array-util.js.map +1 -1
- package/package.json +1 -1
package/lib/array-util.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export declare const arrayUtil: {
|
|
2
2
|
/**
|
|
3
|
-
* Check if array is empty
|
|
3
|
+
* Check if array element is not empty
|
|
4
4
|
* @template T
|
|
5
5
|
* @param {T | null | undefined} value
|
|
6
6
|
* @return {value is T}
|
|
7
7
|
* @example
|
|
8
|
-
* const
|
|
9
|
-
* console.log(
|
|
8
|
+
* const notEmptyArray = [0, 1, 2, null, undefined, ''].filter(arrayUtil.notEmpty))
|
|
9
|
+
* console.log(notEmptyArray)// [0, 1, 2, '']
|
|
10
10
|
*/
|
|
11
11
|
notEmpty: <T>(value: T | null | undefined) => value is T;
|
|
12
|
+
/**
|
|
13
|
+
* Check if array element is not falsy
|
|
14
|
+
* @template T
|
|
15
|
+
* @param {T | null | undefined} value
|
|
16
|
+
* @return {value is T}
|
|
17
|
+
* @example
|
|
18
|
+
* const notFalsyArray = [0, 1, 2, null, undefined, ''].filter(arrayUtil.notFalsy))
|
|
19
|
+
* console.log(notFalsyArray)// [1, 2]
|
|
20
|
+
*/
|
|
21
|
+
notFalsy: <T_1>(value: T_1 | null | undefined) => value is T_1;
|
|
12
22
|
};
|
|
13
23
|
//# sourceMappingURL=array-util.d.ts.map
|
package/lib/array-util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-util.d.ts","sourceRoot":"","sources":["../src/array-util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;IACrB;;;;;;;;OAQG;;CAIH,CAAA"}
|
|
1
|
+
{"version":3,"file":"array-util.d.ts","sourceRoot":"","sources":["../src/array-util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;IACrB;;;;;;;;OAQG;;IAIH;;;;;;;;OAQG;;CAIH,CAAA"}
|
package/lib/array-util.js
CHANGED
|
@@ -3,16 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.arrayUtil = void 0;
|
|
4
4
|
exports.arrayUtil = {
|
|
5
5
|
/**
|
|
6
|
-
* Check if array is empty
|
|
6
|
+
* Check if array element is not empty
|
|
7
7
|
* @template T
|
|
8
8
|
* @param {T | null | undefined} value
|
|
9
9
|
* @return {value is T}
|
|
10
10
|
* @example
|
|
11
|
-
* const
|
|
12
|
-
* console.log(
|
|
11
|
+
* const notEmptyArray = [0, 1, 2, null, undefined, ''].filter(arrayUtil.notEmpty))
|
|
12
|
+
* console.log(notEmptyArray)// [0, 1, 2, '']
|
|
13
13
|
*/
|
|
14
14
|
notEmpty: (value) => {
|
|
15
15
|
return value !== null && value !== undefined;
|
|
16
16
|
},
|
|
17
|
+
/**
|
|
18
|
+
* Check if array element is not falsy
|
|
19
|
+
* @template T
|
|
20
|
+
* @param {T | null | undefined} value
|
|
21
|
+
* @return {value is T}
|
|
22
|
+
* @example
|
|
23
|
+
* const notFalsyArray = [0, 1, 2, null, undefined, ''].filter(arrayUtil.notFalsy))
|
|
24
|
+
* console.log(notFalsyArray)// [1, 2]
|
|
25
|
+
*/
|
|
26
|
+
notFalsy: (value) => {
|
|
27
|
+
return !!value;
|
|
28
|
+
},
|
|
17
29
|
};
|
|
18
30
|
//# sourceMappingURL=array-util.js.map
|
package/lib/array-util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-util.js","sourceRoot":"","sources":["../src/array-util.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACxB;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAI,KAA2B,EAAc,EAAE;QACxD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;IAC7C,CAAC;CACD,CAAA"}
|
|
1
|
+
{"version":3,"file":"array-util.js","sourceRoot":"","sources":["../src/array-util.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACxB;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAI,KAA2B,EAAc,EAAE;QACxD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;IAC7C,CAAC;IACD;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAI,KAA2B,EAAc,EAAE;QACxD,OAAO,CAAC,CAAC,KAAK,CAAA;IACf,CAAC;CACD,CAAA"}
|
package/package.json
CHANGED