@jiakun-zhao/utils 0.1.2 → 0.1.4
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 +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const utils = require('@antfu/utils');
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function to(value, block) {
|
|
6
6
|
return block(value);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function use(value, block) {
|
|
9
9
|
block(value);
|
|
10
10
|
return value;
|
|
11
11
|
}
|
|
@@ -21,11 +21,11 @@ function singleOrNull(arr) {
|
|
|
21
21
|
return arr.length === 1 ? arr[0] : null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
exports.fromLet = fromLet;
|
|
25
|
-
exports.fromTo = fromTo;
|
|
26
24
|
exports.isNotEmpty = isNotEmpty;
|
|
27
25
|
exports.singleOrNull = singleOrNull;
|
|
28
26
|
exports.takeIf = takeIf;
|
|
27
|
+
exports.to = to;
|
|
28
|
+
exports.use = use;
|
|
29
29
|
Object.keys(utils).forEach(function (k) {
|
|
30
30
|
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = utils[k];
|
|
31
31
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@antfu/utils';
|
|
2
2
|
|
|
3
|
-
declare function
|
|
4
|
-
declare function
|
|
3
|
+
declare function to<T, R>(value: T, block: (it: T) => R): R;
|
|
4
|
+
declare function use<T>(value: T, block: (it: T) => void): T;
|
|
5
5
|
declare function takeIf<T>(value: T, predicate: (it: T) => boolean): T | null;
|
|
6
6
|
declare function isNotEmpty(o: any): boolean;
|
|
7
7
|
declare function singleOrNull<T>(arr: T[]): T | null;
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { isNotEmpty, singleOrNull, takeIf, to, use };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@antfu/utils';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function to(value, block) {
|
|
4
4
|
return block(value);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function use(value, block) {
|
|
7
7
|
block(value);
|
|
8
8
|
return value;
|
|
9
9
|
}
|
|
@@ -19,4 +19,4 @@ function singleOrNull(arr) {
|
|
|
19
19
|
return arr.length === 1 ? arr[0] : null;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { isNotEmpty, singleOrNull, takeIf, to, use };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jiakun-zhao/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Utils.",
|
|
6
6
|
"author": "Jiakun Zhao <jiakun.zhao@outlook.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@antfu/utils": "^0.7.
|
|
30
|
+
"@antfu/utils": "^0.7.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@jiakun-zhao/eslint-config": "^1.2.
|
|
34
|
-
"@types/node": "^20.
|
|
35
|
-
"bumpp": "^9.
|
|
36
|
-
"eslint": "^8.
|
|
33
|
+
"@jiakun-zhao/eslint-config": "^1.2.2",
|
|
34
|
+
"@types/node": "^20.5.1",
|
|
35
|
+
"bumpp": "^9.2.0",
|
|
36
|
+
"eslint": "^8.47.0",
|
|
37
37
|
"esno": "^0.17.0",
|
|
38
38
|
"typescript": "^5.1.6",
|
|
39
39
|
"unbuild": "^1.2.1"
|