@jiakun-zhao/utils 0.1.2 → 0.1.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 CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  const utils = require('@antfu/utils');
4
4
 
5
- function fromTo(value, block) {
5
+ function to(value, block) {
6
6
  return block(value);
7
7
  }
8
- function fromLet(value, block) {
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 fromTo<T, R>(value: T, block: (it: T) => R): R;
4
- declare function fromLet<T>(value: T, block: (it: T) => void): T;
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 { fromLet, fromTo, isNotEmpty, singleOrNull, takeIf };
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 fromTo(value, block) {
3
+ function to(value, block) {
4
4
  return block(value);
5
5
  }
6
- function fromLet(value, block) {
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 { fromLet, fromTo, isNotEmpty, singleOrNull, takeIf };
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.2",
4
+ "version": "0.1.3",
5
5
  "description": "Utils.",
6
6
  "author": "Jiakun Zhao <jiakun.zhao@outlook.com>",
7
7
  "license": "MIT",