@hairy/utils 0.7.2 → 0.7.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
@@ -72,6 +72,7 @@ __export(src_exports, {
72
72
  plus: () => plus,
73
73
  riposte: () => riposte,
74
74
  unum: () => unum,
75
+ unwrap: () => unwrap,
75
76
  weexPlatform: () => weexPlatform,
76
77
  whenever: () => whenever,
77
78
  zerofill: () => zerofill,
@@ -204,6 +205,9 @@ function riposte(...args) {
204
205
  }
205
206
  return void 0;
206
207
  }
208
+ function unwrap(value) {
209
+ return typeof value === "function" ? value() : value;
210
+ }
207
211
 
208
212
  // ../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.mjs
209
213
  var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
@@ -1847,6 +1851,7 @@ function cover(value, mode, symbol = "*") {
1847
1851
  plus,
1848
1852
  riposte,
1849
1853
  unum,
1854
+ unwrap,
1850
1855
  weexPlatform,
1851
1856
  whenever,
1852
1857
  zerofill,
package/dist/index.d.ts CHANGED
@@ -119,7 +119,8 @@ declare function delay(ms: number): Promise<unknown>;
119
119
  declare function arange(x1: number, x2?: number, stp?: number, z?: number[], z0?: number): number[];
120
120
  declare function whenever<T, C extends (value: Exclude<T, null | undefined>) => any>(value: T, callback: C): ReturnType<C> | undefined;
121
121
  declare function loop<T = void>(fn: (next: (ms: number) => Promise<T>) => Promise<T>): Promise<T>;
122
- declare function riposte<T>(...args: [cond: boolean, value: T][]): T;
122
+ declare function riposte<T>(...args: [cond: boolean, value: T][]): T;
123
+ declare function unwrap<T extends object>(value: T | (() => T)): T;
123
124
 
124
125
  declare const BIG_INTS: {
125
126
  t: {
@@ -218,4 +219,4 @@ declare function formatNumeric(value?: Numeric, options?: FormatNumericOptions):
218
219
  */
219
220
  declare function cover(value: string, mode: [number, number, number], symbol?: string): string;
220
221
 
221
- export { Arrayable, Awaitable, BIG_INTS, BooleanLike, DecimalOptions, DeepKeyof, DeepPartial, DeepReadonly, DeepReplace, DeepRequired, Deferred, Delimiter, Dimension, DynamicObject, FormatGroupOptions, FormatNumericOptions, Key, NumberObject, Numberish, Numeric, NumericObject, Option, StringObject, SymbolObject, TypeofType, UA, arange, average, compose, cover, decimal, delay, formDataToObject, formatNumeric, formatSize, formatUnit, getTypeof, gt, gte, integer, isAndroid, isArray, isBrowser, isChrome, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isNull, isNumber, isObject, isPhantomJS, isPlainObject, isString, isTypeof, isWeex, isWindow, loop, lt, lte, noop, numerfix, objectToFormData, pPipe, parseNumeric, percentage, pipe, plus, riposte, unum, weexPlatform, whenever, zerofill, zeromove };
222
+ export { Arrayable, Awaitable, BIG_INTS, BooleanLike, DecimalOptions, DeepKeyof, DeepPartial, DeepReadonly, DeepReplace, DeepRequired, Deferred, Delimiter, Dimension, DynamicObject, FormatGroupOptions, FormatNumericOptions, Key, NumberObject, Numberish, Numeric, NumericObject, Option, StringObject, SymbolObject, TypeofType, UA, arange, average, compose, cover, decimal, delay, formDataToObject, formatNumeric, formatSize, formatUnit, getTypeof, gt, gte, integer, isAndroid, isArray, isBrowser, isChrome, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isNull, isNumber, isObject, isPhantomJS, isPlainObject, isString, isTypeof, isWeex, isWindow, loop, lt, lte, noop, numerfix, objectToFormData, pPipe, parseNumeric, percentage, pipe, plus, riposte, unum, unwrap, weexPlatform, whenever, zerofill, zeromove };
package/dist/index.mjs CHANGED
@@ -123,6 +123,9 @@ function riposte(...args) {
123
123
  }
124
124
  return void 0;
125
125
  }
126
+ function unwrap(value) {
127
+ return typeof value === "function" ? value() : value;
128
+ }
126
129
 
127
130
  // ../../node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.mjs
128
131
  var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
@@ -1765,6 +1768,7 @@ export {
1765
1768
  plus,
1766
1769
  riposte,
1767
1770
  unum,
1771
+ unwrap,
1768
1772
  weexPlatform,
1769
1773
  whenever,
1770
1774
  zerofill,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hairy/utils",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.cjs",
6
6
  "publishConfig": {