@hairy/utils 1.40.0 → 1.42.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/dist/index.cjs +8 -8
- package/dist/index.d.ts +3 -3
- package/dist/index.global.js +4 -4
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -62,7 +62,7 @@ __export(index_exports, {
|
|
|
62
62
|
formatNumeric: () => formatNumeric,
|
|
63
63
|
formatSize: () => formatSize,
|
|
64
64
|
formatUnit: () => formatUnit,
|
|
65
|
-
|
|
65
|
+
formdataToObject: () => formdataToObject,
|
|
66
66
|
get: () => get_default,
|
|
67
67
|
getTypeof: () => getTypeof,
|
|
68
68
|
groupBy: () => groupBy_default,
|
|
@@ -132,7 +132,7 @@ __export(index_exports, {
|
|
|
132
132
|
noop: () => noop2,
|
|
133
133
|
numberify: () => numberify,
|
|
134
134
|
numberish: () => numberish,
|
|
135
|
-
|
|
135
|
+
objectToFormdata: () => objectToFormdata,
|
|
136
136
|
off: () => off,
|
|
137
137
|
on: () => on,
|
|
138
138
|
parseNumeric: () => parseNumeric,
|
|
@@ -3336,10 +3336,10 @@ function compose(...fns) {
|
|
|
3336
3336
|
compose.promise = pCompose;
|
|
3337
3337
|
|
|
3338
3338
|
// src/util/converts.ts
|
|
3339
|
-
function
|
|
3339
|
+
function formdataToObject(formData) {
|
|
3340
3340
|
return Object.fromEntries(formData.entries());
|
|
3341
3341
|
}
|
|
3342
|
-
function
|
|
3342
|
+
function objectToFormdata(object) {
|
|
3343
3343
|
const formdata = new FormData();
|
|
3344
3344
|
for (const [key, value] of Object.entries(object))
|
|
3345
3345
|
formdata.set(key, value);
|
|
@@ -3566,8 +3566,8 @@ function lt(a, b) {
|
|
|
3566
3566
|
}
|
|
3567
3567
|
function plus(array, options) {
|
|
3568
3568
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
|
3569
|
-
const decimal2 = options?.d ||
|
|
3570
|
-
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(
|
|
3569
|
+
const decimal2 = options?.d || 6;
|
|
3570
|
+
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(numberish(v)), bignumber(0)).toFixed(decimal2, rounding);
|
|
3571
3571
|
}
|
|
3572
3572
|
function divs(array, options) {
|
|
3573
3573
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
|
@@ -3763,7 +3763,7 @@ function isTypeof(target, type) {
|
|
|
3763
3763
|
formatNumeric,
|
|
3764
3764
|
formatSize,
|
|
3765
3765
|
formatUnit,
|
|
3766
|
-
|
|
3766
|
+
formdataToObject,
|
|
3767
3767
|
get,
|
|
3768
3768
|
getTypeof,
|
|
3769
3769
|
groupBy,
|
|
@@ -3833,7 +3833,7 @@ function isTypeof(target, type) {
|
|
|
3833
3833
|
noop,
|
|
3834
3834
|
numberify,
|
|
3835
3835
|
numberish,
|
|
3836
|
-
|
|
3836
|
+
objectToFormdata,
|
|
3837
3837
|
off,
|
|
3838
3838
|
on,
|
|
3839
3839
|
parseNumeric,
|
package/dist/index.d.ts
CHANGED
|
@@ -497,12 +497,12 @@ declare namespace compose {
|
|
|
497
497
|
* formData to object
|
|
498
498
|
* @param formData
|
|
499
499
|
*/
|
|
500
|
-
declare function
|
|
500
|
+
declare function formdataToObject(formData: FormData): Record<string, string>;
|
|
501
501
|
/**
|
|
502
502
|
* Object to formData
|
|
503
503
|
* @param object
|
|
504
504
|
*/
|
|
505
|
-
declare function
|
|
505
|
+
declare function objectToFormdata(object: Record<string, string | File>): FormData;
|
|
506
506
|
/**
|
|
507
507
|
* Check if a value is not NaN.
|
|
508
508
|
* @param value - The value to check.
|
|
@@ -647,4 +647,4 @@ declare function unwrap<T extends object>(value: T | (() => T)): T;
|
|
|
647
647
|
declare function whenever<T, C extends (value: Exclude<T, null | undefined>) => any>(value: T, callback: C): ReturnType<C> | undefined;
|
|
648
648
|
declare function call<T extends Fn$1<any>>(fn: T, ...args: Parameters<T>): ReturnType<T>;
|
|
649
649
|
|
|
650
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Assign, type Awaitable, BIG_INTS, Bignumber, type BooleanLike, type BrowserNativeObject, type ConstructorType, DEFAULT_BIGNUM_CONFIG, type DecimalOptions, type DeepKeyof, type DeepMap, type DeepMerge, type DeepPartial, type DeepReadonly, type DeepReplace, type DeepRequired, Deferred, type Delimiter, type Dimension, type DynamicObject, type ElementOf, type Fn$1 as Fn, type FormatGroupOptions, type FormatNumericOptions, type IfAny, type IsAny, type Key, type Looper, type MergeInsertions, type NonUndefined, type Noop, type Nullable, type NumberObject, type Numberish, type Numeric, type NumericObject, type OmitBy, type OpenFilePickerOptions, type OpenImagePickerOptions, type Option, type Overwrite, type PickBy, type PromiseFn, type PromiseType, type Promisify, type ReaderType, type StringObject, type SymbolObject, type Typeof, arange, average, bignumber, call, camelCase, capitalCase, compose, constantCase, cover, decimal, delay, dialsPhone, divs, dotCase, downloadBlobFile, downloadNetworkFile, ensurePrefix, ensureSuffix, formatNumeric, formatSize, formatUnit,
|
|
650
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Assign, type Awaitable, BIG_INTS, Bignumber, type BooleanLike, type BrowserNativeObject, type ConstructorType, DEFAULT_BIGNUM_CONFIG, type DecimalOptions, type DeepKeyof, type DeepMap, type DeepMerge, type DeepPartial, type DeepReadonly, type DeepReplace, type DeepRequired, Deferred, type Delimiter, type Dimension, type DynamicObject, type ElementOf, type Fn$1 as Fn, type FormatGroupOptions, type FormatNumericOptions, type IfAny, type IsAny, type Key, type Looper, type MergeInsertions, type NonUndefined, type Noop, type Nullable, type NumberObject, type Numberish, type Numeric, type NumericObject, type OmitBy, type OpenFilePickerOptions, type OpenImagePickerOptions, type Option, type Overwrite, type PickBy, type PromiseFn, type PromiseType, type Promisify, type ReaderType, type StringObject, type SymbolObject, type Typeof, arange, average, bignumber, call, camelCase, capitalCase, compose, constantCase, cover, decimal, delay, dialsPhone, divs, dotCase, downloadBlobFile, downloadNetworkFile, ensurePrefix, ensureSuffix, formatNumeric, formatSize, formatUnit, formdataToObject, getTypeof, gt, gte, integer, isAndroid, isBrowser, isChrome, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isPhantomJS, isTruthy, isTypeof, isWeex, isWindow, jsonTryParse, kebabCase, loop, lt, lte, noCase, nonnanable, noop, numberify, numberish, objectToFormdata, off, on, parseNumeric, pascalCase, pascalSnakeCase, pathCase, percentage, pipe, plus, proxy, randomArray, randomNumber, randomString, readFileReader, redirectTo, riposte, selectImages, sentenceCase, showOpenFilePicker, showOpenImagePicker, slash, snakeCase, stringify, template, to, toArray, trainCase, unindent, unwrap, whenever, zerofill, zeromove };
|
package/dist/index.global.js
CHANGED
|
@@ -4503,10 +4503,10 @@
|
|
|
4503
4503
|
compose.promise = pCompose;
|
|
4504
4504
|
|
|
4505
4505
|
// src/util/converts.ts
|
|
4506
|
-
function
|
|
4506
|
+
function formdataToObject(formData) {
|
|
4507
4507
|
return Object.fromEntries(formData.entries());
|
|
4508
4508
|
}
|
|
4509
|
-
function
|
|
4509
|
+
function objectToFormdata(object) {
|
|
4510
4510
|
const formdata = new FormData();
|
|
4511
4511
|
for (const [key, value] of Object.entries(object))
|
|
4512
4512
|
formdata.set(key, value);
|
|
@@ -4733,8 +4733,8 @@
|
|
|
4733
4733
|
}
|
|
4734
4734
|
function plus(array, options) {
|
|
4735
4735
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
|
4736
|
-
const decimal2 = options?.d ||
|
|
4737
|
-
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(
|
|
4736
|
+
const decimal2 = options?.d || 6;
|
|
4737
|
+
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(numberish(v)), bignumber(0)).toFixed(decimal2, rounding);
|
|
4738
4738
|
}
|
|
4739
4739
|
function divs(array, options) {
|
|
4740
4740
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
package/dist/index.js
CHANGED
|
@@ -3160,10 +3160,10 @@ function compose(...fns) {
|
|
|
3160
3160
|
compose.promise = pCompose;
|
|
3161
3161
|
|
|
3162
3162
|
// src/util/converts.ts
|
|
3163
|
-
function
|
|
3163
|
+
function formdataToObject(formData) {
|
|
3164
3164
|
return Object.fromEntries(formData.entries());
|
|
3165
3165
|
}
|
|
3166
|
-
function
|
|
3166
|
+
function objectToFormdata(object) {
|
|
3167
3167
|
const formdata = new FormData();
|
|
3168
3168
|
for (const [key, value] of Object.entries(object))
|
|
3169
3169
|
formdata.set(key, value);
|
|
@@ -3390,8 +3390,8 @@ function lt(a, b) {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
function plus(array, options) {
|
|
3392
3392
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
|
3393
|
-
const decimal2 = options?.d ||
|
|
3394
|
-
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(
|
|
3393
|
+
const decimal2 = options?.d || 6;
|
|
3394
|
+
return array.filter((v) => bignumber(v).gt(0)).reduce((t, v) => t.plus(numberish(v)), bignumber(0)).toFixed(decimal2, rounding);
|
|
3395
3395
|
}
|
|
3396
3396
|
function divs(array, options) {
|
|
3397
3397
|
const rounding = options?.r || Bignumber.ROUND_DOWN;
|
|
@@ -3586,7 +3586,7 @@ export {
|
|
|
3586
3586
|
formatNumeric,
|
|
3587
3587
|
formatSize,
|
|
3588
3588
|
formatUnit,
|
|
3589
|
-
|
|
3589
|
+
formdataToObject,
|
|
3590
3590
|
get_default as get,
|
|
3591
3591
|
getTypeof,
|
|
3592
3592
|
groupBy_default as groupBy,
|
|
@@ -3656,7 +3656,7 @@ export {
|
|
|
3656
3656
|
noop2 as noop,
|
|
3657
3657
|
numberify,
|
|
3658
3658
|
numberish,
|
|
3659
|
-
|
|
3659
|
+
objectToFormdata,
|
|
3660
3660
|
off,
|
|
3661
3661
|
on,
|
|
3662
3662
|
parseNumeric,
|