@vielzeug/toolkit 1.0.12 → 1.0.14
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/array/{sortBy.cjs → arrange.cjs} +2 -2
- package/dist/array/arrange.cjs.map +1 -0
- package/dist/array/arrange.js +6 -0
- package/dist/array/arrange.js.map +1 -0
- package/dist/array/chunk.cjs +1 -1
- package/dist/array/chunk.cjs.map +1 -1
- package/dist/array/chunk.js +15 -12
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/group.cjs +1 -1
- package/dist/array/group.cjs.map +1 -1
- package/dist/array/group.js +9 -9
- package/dist/array/group.js.map +1 -1
- package/dist/array/list.cjs +1 -1
- package/dist/array/list.cjs.map +1 -1
- package/dist/array/list.js +87 -50
- package/dist/array/list.js.map +1 -1
- package/dist/array/pick.cjs.map +1 -1
- package/dist/array/pick.js.map +1 -1
- package/dist/array/remoteList.cjs +2 -0
- package/dist/array/remoteList.cjs.map +1 -0
- package/dist/array/remoteList.js +123 -0
- package/dist/array/remoteList.js.map +1 -0
- package/dist/date/expires.cjs.map +1 -1
- package/dist/date/expires.js.map +1 -1
- package/dist/date/interval.cjs.map +1 -1
- package/dist/date/interval.js.map +1 -1
- package/dist/date/timeDiff.cjs +1 -1
- package/dist/date/timeDiff.cjs.map +1 -1
- package/dist/date/timeDiff.js +10 -12
- package/dist/date/timeDiff.js.map +1 -1
- package/dist/function/curry.cjs +1 -1
- package/dist/function/curry.cjs.map +1 -1
- package/dist/function/curry.js +3 -3
- package/dist/function/curry.js.map +1 -1
- package/dist/function/debounce.cjs +1 -1
- package/dist/function/debounce.cjs.map +1 -1
- package/dist/function/debounce.js +22 -5
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/memo.cjs +1 -1
- package/dist/function/memo.cjs.map +1 -1
- package/dist/function/memo.js +14 -13
- package/dist/function/memo.js.map +1 -1
- package/dist/function/parallel.cjs +2 -0
- package/dist/function/parallel.cjs.map +1 -0
- package/dist/function/parallel.js +28 -0
- package/dist/function/parallel.js.map +1 -0
- package/dist/function/proxy.cjs.map +1 -1
- package/dist/function/proxy.js.map +1 -1
- package/dist/function/prune.cjs +2 -0
- package/dist/function/prune.cjs.map +1 -0
- package/dist/function/prune.js +30 -0
- package/dist/function/prune.js.map +1 -0
- package/dist/function/retry.cjs +1 -1
- package/dist/function/retry.cjs.map +1 -1
- package/dist/function/retry.js +13 -13
- package/dist/function/retry.js.map +1 -1
- package/dist/function/sleep.cjs +1 -1
- package/dist/function/sleep.cjs.map +1 -1
- package/dist/function/sleep.js +8 -3
- package/dist/function/sleep.js.map +1 -1
- package/dist/function/throttle.cjs +1 -1
- package/dist/function/throttle.cjs.map +1 -1
- package/dist/function/throttle.js +33 -6
- package/dist/function/throttle.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +455 -95
- package/dist/index.js +218 -194
- package/dist/index.js.map +1 -1
- package/dist/math/abs.cjs +2 -0
- package/dist/math/abs.cjs.map +1 -0
- package/dist/math/abs.js +7 -0
- package/dist/math/abs.js.map +1 -0
- package/dist/math/add.cjs +2 -0
- package/dist/math/add.cjs.map +1 -0
- package/dist/math/add.js +9 -0
- package/dist/math/add.js.map +1 -0
- package/dist/math/allocate.cjs +2 -0
- package/dist/math/allocate.cjs.map +1 -0
- package/dist/math/allocate.js +29 -0
- package/dist/math/allocate.js.map +1 -0
- package/dist/math/average.cjs +1 -1
- package/dist/math/average.cjs.map +1 -1
- package/dist/math/average.js +18 -12
- package/dist/math/average.js.map +1 -1
- package/dist/math/distribute.cjs +2 -0
- package/dist/math/distribute.cjs.map +1 -0
- package/dist/math/distribute.js +18 -0
- package/dist/math/distribute.js.map +1 -0
- package/dist/math/divide.cjs +2 -0
- package/dist/math/divide.cjs.map +1 -0
- package/dist/math/divide.js +11 -0
- package/dist/math/divide.js.map +1 -0
- package/dist/math/median.cjs.map +1 -1
- package/dist/math/median.js.map +1 -1
- package/dist/math/multiply.cjs +2 -0
- package/dist/math/multiply.cjs.map +1 -0
- package/dist/math/multiply.js +9 -0
- package/dist/math/multiply.js.map +1 -0
- package/dist/math/range.cjs +1 -1
- package/dist/math/range.cjs.map +1 -1
- package/dist/math/range.js +14 -6
- package/dist/math/range.js.map +1 -1
- package/dist/math/subtract.cjs +2 -0
- package/dist/math/subtract.cjs.map +1 -0
- package/dist/math/subtract.js +9 -0
- package/dist/math/subtract.js.map +1 -0
- package/dist/math/sum.cjs +1 -1
- package/dist/math/sum.cjs.map +1 -1
- package/dist/math/sum.js +11 -18
- package/dist/math/sum.js.map +1 -1
- package/dist/money/currency.cjs +2 -0
- package/dist/money/currency.cjs.map +1 -0
- package/dist/money/currency.js +49 -0
- package/dist/money/currency.js.map +1 -0
- package/dist/money/exchange.cjs +2 -0
- package/dist/money/exchange.cjs.map +1 -0
- package/dist/money/exchange.js +13 -0
- package/dist/money/exchange.js.map +1 -0
- package/dist/object/clone.cjs +1 -1
- package/dist/object/clone.cjs.map +1 -1
- package/dist/object/clone.js +13 -3
- package/dist/object/clone.js.map +1 -1
- package/dist/object/merge.cjs +1 -1
- package/dist/object/merge.cjs.map +1 -1
- package/dist/object/merge.js +11 -15
- package/dist/object/merge.js.map +1 -1
- package/dist/object/parseJSON.cjs.map +1 -1
- package/dist/object/parseJSON.js.map +1 -1
- package/dist/object/path.cjs.map +1 -1
- package/dist/object/path.js.map +1 -1
- package/dist/object/seek.cjs +1 -1
- package/dist/object/seek.cjs.map +1 -1
- package/dist/object/seek.js +8 -6
- package/dist/object/seek.js.map +1 -1
- package/dist/random/uuid.cjs +1 -1
- package/dist/random/uuid.cjs.map +1 -1
- package/dist/random/uuid.js +6 -3
- package/dist/random/uuid.js.map +1 -1
- package/dist/string/camelCase.cjs +1 -1
- package/dist/string/camelCase.cjs.map +1 -1
- package/dist/string/camelCase.js +3 -3
- package/dist/string/camelCase.js.map +1 -1
- package/dist/string/similarity.cjs +1 -1
- package/dist/string/similarity.cjs.map +1 -1
- package/dist/string/similarity.js +24 -21
- package/dist/string/similarity.js.map +1 -1
- package/dist/string/truncate.cjs +1 -1
- package/dist/string/truncate.cjs.map +1 -1
- package/dist/string/truncate.js +14 -5
- package/dist/string/truncate.js.map +1 -1
- package/dist/typed/is.cjs +1 -1
- package/dist/typed/is.cjs.map +1 -1
- package/dist/typed/is.js +30 -31
- package/dist/typed/is.js.map +1 -1
- package/dist/typed/isEmpty.cjs +1 -1
- package/dist/typed/isEmpty.cjs.map +1 -1
- package/dist/typed/isEmpty.js +6 -6
- package/dist/typed/isEmpty.js.map +1 -1
- package/dist/typed/isEqual.cjs +1 -1
- package/dist/typed/isEqual.cjs.map +1 -1
- package/dist/typed/isEqual.js +22 -17
- package/dist/typed/isEqual.js.map +1 -1
- package/package.json +1 -1
- package/dist/array/sortBy.cjs.map +0 -1
- package/dist/array/sortBy.js +0 -6
- package/dist/array/sortBy.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -4,214 +4,238 @@ import { chunk as f } from "./array/chunk.js";
|
|
|
4
4
|
import { compact as i } from "./array/compact.js";
|
|
5
5
|
import { contains as a } from "./array/contains.js";
|
|
6
6
|
import { every as _ } from "./array/every.js";
|
|
7
|
-
import { filter as
|
|
8
|
-
import { find as
|
|
9
|
-
import { findIndex as
|
|
10
|
-
import { findLast as
|
|
7
|
+
import { filter as l } from "./array/filter.js";
|
|
8
|
+
import { find as c } from "./array/find.js";
|
|
9
|
+
import { findIndex as d } from "./array/findIndex.js";
|
|
10
|
+
import { findLast as I } from "./array/findLast.js";
|
|
11
11
|
import { flatten as M } from "./array/flatten.js";
|
|
12
|
-
import { group as
|
|
13
|
-
import { list as
|
|
14
|
-
import { map as
|
|
12
|
+
import { group as y } from "./array/group.js";
|
|
13
|
+
import { list as b } from "./array/list.js";
|
|
14
|
+
import { map as v } from "./array/map.js";
|
|
15
15
|
import { pick as k } from "./array/pick.js";
|
|
16
16
|
import { reduce as T } from "./array/reduce.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
17
|
+
import { remoteList as A } from "./array/remoteList.js";
|
|
18
|
+
import { search as D } from "./array/search.js";
|
|
19
|
+
import { select as U } from "./array/select.js";
|
|
20
|
+
import { shift as w } from "./array/shift.js";
|
|
21
|
+
import { some as J } from "./array/some.js";
|
|
22
|
+
import { sort as Y } from "./array/sort.js";
|
|
23
|
+
import { arrange as H } from "./array/arrange.js";
|
|
24
|
+
import { substitute as V } from "./array/substitute.js";
|
|
25
|
+
import { uniq as z } from "./array/uniq.js";
|
|
26
|
+
import { expires as X } from "./date/expires.js";
|
|
27
|
+
import { interval as rr } from "./date/interval.js";
|
|
28
|
+
import { timeDiff as er } from "./date/timeDiff.js";
|
|
29
|
+
import { assert as mr } from "./function/assert.js";
|
|
30
|
+
import { assertParams as fr } from "./function/assertParams.js";
|
|
31
|
+
import { attempt as ir } from "./function/attempt.js";
|
|
32
|
+
import { compare as ar } from "./function/compare.js";
|
|
33
|
+
import { compareBy as _r } from "./function/compareBy.js";
|
|
34
|
+
import { compose as lr } from "./function/compose.js";
|
|
35
|
+
import { curry as cr } from "./function/curry.js";
|
|
36
|
+
import { debounce as dr } from "./function/debounce.js";
|
|
36
37
|
import { delay as Ir } from "./function/delay.js";
|
|
37
|
-
import { fp as
|
|
38
|
-
import { memo as
|
|
39
|
-
import { once as
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
38
|
+
import { fp as Mr } from "./function/fp.js";
|
|
39
|
+
import { memo as yr } from "./function/memo.js";
|
|
40
|
+
import { once as br } from "./function/once.js";
|
|
41
|
+
import { parallel as vr } from "./function/parallel.js";
|
|
42
|
+
import { pipe as kr } from "./function/pipe.js";
|
|
43
|
+
import { predict as Tr } from "./function/predict.js";
|
|
44
|
+
import { proxy as Ar } from "./function/proxy.js";
|
|
45
|
+
import { prune as Dr } from "./function/prune.js";
|
|
46
|
+
import { retry as Ur } from "./function/retry.js";
|
|
47
|
+
import { sleep as wr } from "./function/sleep.js";
|
|
48
|
+
import { throttle as Jr } from "./function/throttle.js";
|
|
49
|
+
import { worker as Yr } from "./function/worker.js";
|
|
50
|
+
import { abs as Hr } from "./math/abs.js";
|
|
51
|
+
import { add as Vr } from "./math/add.js";
|
|
52
|
+
import { allocate as zr } from "./math/allocate.js";
|
|
53
|
+
import { average as Xr } from "./math/average.js";
|
|
54
|
+
import { boil as ro } from "./math/boil.js";
|
|
55
|
+
import { clamp as eo } from "./math/clamp.js";
|
|
56
|
+
import { distribute as mo } from "./math/distribute.js";
|
|
57
|
+
import { divide as fo } from "./math/divide.js";
|
|
58
|
+
import { max as io } from "./math/max.js";
|
|
59
|
+
import { median as ao } from "./math/median.js";
|
|
60
|
+
import { min as _o } from "./math/min.js";
|
|
61
|
+
import { multiply as lo } from "./math/multiply.js";
|
|
62
|
+
import { range as co } from "./math/range.js";
|
|
63
|
+
import { rate as Eo } from "./math/rate.js";
|
|
64
|
+
import { round as Oo } from "./math/round.js";
|
|
65
|
+
import { subtract as go } from "./math/subtract.js";
|
|
66
|
+
import { sum as Go } from "./math/sum.js";
|
|
67
|
+
import { currency as No } from "./money/currency.js";
|
|
68
|
+
import { exchange as ho } from "./money/exchange.js";
|
|
69
|
+
import { clone as Po } from "./object/clone.js";
|
|
70
|
+
import { diff as Co } from "./object/diff.js";
|
|
71
|
+
import { entries as Bo } from "./object/entries.js";
|
|
72
|
+
import { keys as Lo } from "./object/keys.js";
|
|
73
|
+
import { merge as qo } from "./object/merge.js";
|
|
74
|
+
import { parseJSON as Fo } from "./object/parseJSON.js";
|
|
75
|
+
import { path as Wo } from "./object/path.js";
|
|
76
|
+
import { seek as jo } from "./object/seek.js";
|
|
77
|
+
import { values as Qo } from "./object/values.js";
|
|
78
|
+
import { draw as Zo } from "./random/draw.js";
|
|
79
|
+
import { random as Ko } from "./random/random.js";
|
|
80
|
+
import { shuffle as $o } from "./random/shuffle.js";
|
|
81
|
+
import { uuid as oe } from "./random/uuid.js";
|
|
82
|
+
import { camelCase as te } from "./string/camelCase.js";
|
|
83
|
+
import { kebabCase as pe } from "./string/kebabCase.js";
|
|
84
|
+
import { pascalCase as xe } from "./string/pascalCase.js";
|
|
85
|
+
import { similarity as se } from "./string/similarity.js";
|
|
86
|
+
import { snakeCase as Re } from "./string/snakeCase.js";
|
|
87
|
+
import { truncate as ne } from "./string/truncate.js";
|
|
88
|
+
import { ge as Se } from "./typed/ge.js";
|
|
89
|
+
import { gt as ue } from "./typed/gt.js";
|
|
90
|
+
import { is as Ee } from "./typed/is.js";
|
|
91
|
+
import { IS_ARRAY_ERROR_MSG as Oe, isArray as Me } from "./typed/isArray.js";
|
|
92
|
+
import { isBoolean as ye } from "./typed/isBoolean.js";
|
|
93
|
+
import { IS_DATE_ERROR_MSG as be, isDate as Ne } from "./typed/isDate.js";
|
|
94
|
+
import { isDefined as he } from "./typed/isDefined.js";
|
|
95
|
+
import { IS_EMPTY_ERROR_MSG as Pe, isEmpty as Te } from "./typed/isEmpty.js";
|
|
96
|
+
import { IS_EQUAL_ERROR_MSG as Ae, isEqual as Be } from "./typed/isEqual.js";
|
|
97
|
+
import { isEven as Le } from "./typed/isEven.js";
|
|
98
|
+
import { IS_FUNCTION_ERROR_MSG as qe, isFunction as we } from "./typed/isFunction.js";
|
|
99
|
+
import { isNegative as Je } from "./typed/isNegative.js";
|
|
100
|
+
import { IS_NIL_ERROR_MSG as Ye, isNil as je } from "./typed/isNil.js";
|
|
101
|
+
import { IS_NUMBER_ERROR_MSG as Qe, isNumber as Ve } from "./typed/isNumber.js";
|
|
102
|
+
import { IS_OBJECT_ERROR_MSG as ze, isObject as Ke } from "./typed/isObject.js";
|
|
103
|
+
import { isOdd as $e } from "./typed/isOdd.js";
|
|
104
|
+
import { isPositive as ot } from "./typed/isPositive.js";
|
|
105
|
+
import { IS_PRIMITIVE_ERROR_MSG as tt, isPrimitive as mt } from "./typed/isPrimitive.js";
|
|
106
|
+
import { IS_PROMISE_ERROR_MSG as ft, isPromise as xt } from "./typed/isPromise.js";
|
|
107
|
+
import { isRegex as st } from "./typed/isRegex.js";
|
|
108
|
+
import { IS_STRING_ERROR_MSG as Rt, isString as _t } from "./typed/isString.js";
|
|
109
|
+
import { IS_WITHIN_ERROR_MSG as lt, isWithin as St } from "./typed/isWithin.js";
|
|
110
|
+
import { isZero as ut } from "./typed/isZero.js";
|
|
111
|
+
import { le as Et } from "./typed/le.js";
|
|
112
|
+
import { lt as Ot } from "./typed/lt.js";
|
|
113
|
+
import { typeOf as gt } from "./typed/typeOf.js";
|
|
102
114
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
Oe as IS_ARRAY_ERROR_MSG,
|
|
116
|
+
be as IS_DATE_ERROR_MSG,
|
|
117
|
+
Pe as IS_EMPTY_ERROR_MSG,
|
|
118
|
+
Ae as IS_EQUAL_ERROR_MSG,
|
|
119
|
+
qe as IS_FUNCTION_ERROR_MSG,
|
|
120
|
+
Ye as IS_NIL_ERROR_MSG,
|
|
121
|
+
Qe as IS_NUMBER_ERROR_MSG,
|
|
122
|
+
ze as IS_OBJECT_ERROR_MSG,
|
|
123
|
+
tt as IS_PRIMITIVE_ERROR_MSG,
|
|
124
|
+
ft as IS_PROMISE_ERROR_MSG,
|
|
125
|
+
Rt as IS_STRING_ERROR_MSG,
|
|
126
|
+
lt as IS_WITHIN_ERROR_MSG,
|
|
127
|
+
Hr as abs,
|
|
128
|
+
Vr as add,
|
|
115
129
|
e as aggregate,
|
|
130
|
+
zr as allocate,
|
|
116
131
|
m as alternate,
|
|
117
|
-
|
|
118
|
-
mr as
|
|
119
|
-
fr as
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
132
|
+
H as arrange,
|
|
133
|
+
mr as assert,
|
|
134
|
+
fr as assertParams,
|
|
135
|
+
ir as attempt,
|
|
136
|
+
Xr as average,
|
|
137
|
+
ro as boil,
|
|
138
|
+
te as camelCase,
|
|
123
139
|
f as chunk,
|
|
124
|
-
|
|
125
|
-
|
|
140
|
+
eo as clamp,
|
|
141
|
+
Po as clone,
|
|
126
142
|
i as compact,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
ar as compare,
|
|
144
|
+
_r as compareBy,
|
|
145
|
+
lr as compose,
|
|
130
146
|
a as contains,
|
|
131
|
-
|
|
132
|
-
|
|
147
|
+
No as currency,
|
|
148
|
+
cr as curry,
|
|
149
|
+
dr as debounce,
|
|
133
150
|
Ir as delay,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
151
|
+
Co as diff,
|
|
152
|
+
mo as distribute,
|
|
153
|
+
fo as divide,
|
|
154
|
+
Zo as draw,
|
|
155
|
+
Bo as entries,
|
|
137
156
|
_ as every,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
l as
|
|
141
|
-
|
|
142
|
-
|
|
157
|
+
ho as exchange,
|
|
158
|
+
X as expires,
|
|
159
|
+
l as filter,
|
|
160
|
+
c as find,
|
|
161
|
+
d as findIndex,
|
|
162
|
+
I as findLast,
|
|
143
163
|
M as flatten,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
164
|
+
Mr as fp,
|
|
165
|
+
Se as ge,
|
|
166
|
+
y as group,
|
|
167
|
+
ue as gt,
|
|
168
|
+
rr as interval,
|
|
169
|
+
Ee as is,
|
|
170
|
+
Me as isArray,
|
|
171
|
+
ye as isBoolean,
|
|
172
|
+
Ne as isDate,
|
|
173
|
+
he as isDefined,
|
|
174
|
+
Te as isEmpty,
|
|
175
|
+
Be as isEqual,
|
|
176
|
+
Le as isEven,
|
|
177
|
+
we as isFunction,
|
|
178
|
+
Je as isNegative,
|
|
179
|
+
je as isNil,
|
|
180
|
+
Ve as isNumber,
|
|
181
|
+
Ke as isObject,
|
|
182
|
+
$e as isOdd,
|
|
183
|
+
ot as isPositive,
|
|
184
|
+
mt as isPrimitive,
|
|
185
|
+
xt as isPromise,
|
|
186
|
+
st as isRegex,
|
|
187
|
+
_t as isString,
|
|
188
|
+
St as isWithin,
|
|
189
|
+
ut as isZero,
|
|
190
|
+
pe as kebabCase,
|
|
191
|
+
Lo as keys,
|
|
192
|
+
Et as le,
|
|
193
|
+
b as list,
|
|
194
|
+
Ot as lt,
|
|
195
|
+
v as map,
|
|
196
|
+
io as max,
|
|
197
|
+
ao as median,
|
|
198
|
+
yr as memo,
|
|
199
|
+
qo as merge,
|
|
200
|
+
_o as min,
|
|
201
|
+
lo as multiply,
|
|
202
|
+
br as once,
|
|
203
|
+
vr as parallel,
|
|
204
|
+
Fo as parseJSON,
|
|
205
|
+
xe as pascalCase,
|
|
206
|
+
Wo as path,
|
|
185
207
|
k as pick,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
208
|
+
kr as pipe,
|
|
209
|
+
Tr as predict,
|
|
210
|
+
Ar as proxy,
|
|
211
|
+
Dr as prune,
|
|
212
|
+
Ko as random,
|
|
213
|
+
co as range,
|
|
214
|
+
Eo as rate,
|
|
192
215
|
T as reduce,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
U as
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
J as
|
|
205
|
-
Y as
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
+
A as remoteList,
|
|
217
|
+
Ur as retry,
|
|
218
|
+
Oo as round,
|
|
219
|
+
D as search,
|
|
220
|
+
jo as seek,
|
|
221
|
+
U as select,
|
|
222
|
+
w as shift,
|
|
223
|
+
$o as shuffle,
|
|
224
|
+
se as similarity,
|
|
225
|
+
wr as sleep,
|
|
226
|
+
Re as snakeCase,
|
|
227
|
+
J as some,
|
|
228
|
+
Y as sort,
|
|
229
|
+
V as substitute,
|
|
230
|
+
go as subtract,
|
|
231
|
+
Go as sum,
|
|
232
|
+
Jr as throttle,
|
|
233
|
+
er as timeDiff,
|
|
234
|
+
ne as truncate,
|
|
235
|
+
gt as typeOf,
|
|
236
|
+
z as uniq,
|
|
237
|
+
oe as uuid,
|
|
238
|
+
Qo as values,
|
|
239
|
+
Yr as worker
|
|
216
240
|
};
|
|
217
241
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abs.cjs","sources":["../../src/math/abs.ts"],"sourcesContent":["/**\n * Returns the absolute value of a number.\n * Supports both regular numbers and bigint.\n *\n * @example\n * ```ts\n * abs(-5); // 5\n * abs(3); // 3\n * abs(-100n); // 100n\n * ```\n *\n * @param value - The number or bigint to get absolute value of\n * @returns Absolute value\n */\nexport function abs(value: number): number;\nexport function abs(value: bigint): bigint;\nexport function abs(value: number | bigint): number | bigint {\n if (typeof value === 'bigint') {\n return value < 0n ? -value : value;\n }\n return Math.abs(value);\n}\n"],"names":["abs","value"],"mappings":"gFAgBO,SAASA,EAAIC,EAAyC,CAC3D,OAAI,OAAOA,GAAU,SACZA,EAAQ,GAAK,CAACA,EAAQA,EAExB,KAAK,IAAIA,CAAK,CACvB"}
|
package/dist/math/abs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abs.js","sources":["../../src/math/abs.ts"],"sourcesContent":["/**\n * Returns the absolute value of a number.\n * Supports both regular numbers and bigint.\n *\n * @example\n * ```ts\n * abs(-5); // 5\n * abs(3); // 3\n * abs(-100n); // 100n\n * ```\n *\n * @param value - The number or bigint to get absolute value of\n * @returns Absolute value\n */\nexport function abs(value: number): number;\nexport function abs(value: bigint): bigint;\nexport function abs(value: number | bigint): number | bigint {\n if (typeof value === 'bigint') {\n return value < 0n ? -value : value;\n }\n return Math.abs(value);\n}\n"],"names":["abs","value"],"mappings":"AAgBO,SAASA,EAAIC,GAAyC;AAC3D,SAAI,OAAOA,KAAU,WACZA,IAAQ,KAAK,CAACA,IAAQA,IAExB,KAAK,IAAIA,CAAK;AACvB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e,t){if(typeof e=="bigint"&&typeof t=="bigint"||typeof e=="number"&&typeof t=="number")return e+t;throw new TypeError("Both arguments must be of the same type (number or bigint)")}exports.add=r;
|
|
2
|
+
//# sourceMappingURL=add.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.cjs","sources":["../../src/math/add.ts"],"sourcesContent":["/**\n * Adds two numbers with precision handling for financial calculations.\n * Supports both regular numbers and bigint for exact precision.\n *\n * @example\n * ```ts\n * add(10, 20); // 30\n * add(0.1, 0.2); // 0.3 (precision-safe)\n * add(100n, 200n); // 300n\n * ```\n *\n * @param a - First number or bigint\n * @param b - Second number or bigint\n * @returns Sum of a and b\n */\nexport function add(a: number, b: number): number;\nexport function add(a: bigint, b: bigint): bigint;\nexport function add(a: number | bigint, b: number | bigint): number | bigint {\n if (typeof a === 'bigint' && typeof b === 'bigint') {\n return a + b;\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return a + b;\n }\n throw new TypeError('Both arguments must be of the same type (number or bigint)');\n}\n"],"names":["add","a","b"],"mappings":"gFAiBO,SAASA,EAAIC,EAAoBC,EAAqC,CAI3E,GAHI,OAAOD,GAAM,UAAY,OAAOC,GAAM,UAGtC,OAAOD,GAAM,UAAY,OAAOC,GAAM,SACxC,OAAOD,EAAIC,EAEb,MAAM,IAAI,UAAU,4DAA4D,CAClF"}
|
package/dist/math/add.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function r(e, t) {
|
|
2
|
+
if (typeof e == "bigint" && typeof t == "bigint" || typeof e == "number" && typeof t == "number")
|
|
3
|
+
return e + t;
|
|
4
|
+
throw new TypeError("Both arguments must be of the same type (number or bigint)");
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
r as add
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sources":["../../src/math/add.ts"],"sourcesContent":["/**\n * Adds two numbers with precision handling for financial calculations.\n * Supports both regular numbers and bigint for exact precision.\n *\n * @example\n * ```ts\n * add(10, 20); // 30\n * add(0.1, 0.2); // 0.3 (precision-safe)\n * add(100n, 200n); // 300n\n * ```\n *\n * @param a - First number or bigint\n * @param b - Second number or bigint\n * @returns Sum of a and b\n */\nexport function add(a: number, b: number): number;\nexport function add(a: bigint, b: bigint): bigint;\nexport function add(a: number | bigint, b: number | bigint): number | bigint {\n if (typeof a === 'bigint' && typeof b === 'bigint') {\n return a + b;\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return a + b;\n }\n throw new TypeError('Both arguments must be of the same type (number or bigint)');\n}\n"],"names":["add","a","b"],"mappings":"AAiBO,SAASA,EAAIC,GAAoBC,GAAqC;AAI3E,MAHI,OAAOD,KAAM,YAAY,OAAOC,KAAM,YAGtC,OAAOD,KAAM,YAAY,OAAOC,KAAM;AACxC,WAAOD,IAAIC;AAEb,QAAM,IAAI,UAAU,4DAA4D;AAClF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(o,t){if(t.length===0)throw new Error("Ratios array cannot be empty");if(t.some(e=>e<0))throw new Error("Ratios must be non-negative");const n=t.reduce((e,r)=>e+r,0);if(n===0)throw new Error("Total ratio cannot be zero");if(typeof o=="bigint"){const e=[];let r=o;for(let h=0;h<t.length-1;h++){const s=o*BigInt(Math.floor(t[h]*1e6))/BigInt(Math.floor(n*1e6));e.push(s),r-=s}return e.push(r),e}const l=[];let i=o;for(let e=0;e<t.length-1;e++){const r=Math.floor(o*t[e]/n);l.push(r),i-=r}return l.push(i),l}exports.allocate=a;
|
|
2
|
+
//# sourceMappingURL=allocate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allocate.cjs","sources":["../../src/math/allocate.ts"],"sourcesContent":["/**\n * Distributes an amount proportionally according to given ratios.\n * Handles rounding to ensure the sum equals the original amount exactly.\n * Critical for financial operations like splitting payments to avoid rounding errors.\n *\n * @example\n * ```ts\n * // Split $100 in ratio 1:2:3\n * allocate(100, [1, 2, 3]);\n * // [17, 33, 50] - sum is exactly 100\n *\n * // Split with bigint (e.g., cents)\n * allocate(10000n, [1, 1, 1]);\n * // [3334n, 3333n, 3333n] - sum is exactly 10000n\n * ```\n *\n * @param amount - Total amount to allocate\n * @param ratios - Array of ratios for distribution\n * @returns Array of allocated amounts (sum equals original amount)\n * @throws {Error} If ratios array is empty or contains negative values\n */\nexport function allocate(amount: number, ratios: number[]): number[];\nexport function allocate(amount: bigint, ratios: number[]): bigint[];\nexport function allocate(amount: number | bigint, ratios: number[]): (number | bigint)[] {\n if (ratios.length === 0) {\n throw new Error('Ratios array cannot be empty');\n }\n\n if (ratios.some((r) => r < 0)) {\n throw new Error('Ratios must be non-negative');\n }\n\n const totalRatio = ratios.reduce((sum, ratio) => sum + ratio, 0);\n\n if (totalRatio === 0) {\n throw new Error('Total ratio cannot be zero');\n }\n\n if (typeof amount === 'bigint') {\n const results: bigint[] = [];\n let remainder = amount;\n\n for (let i = 0; i < ratios.length - 1; i++) {\n const share = (amount * BigInt(Math.floor(ratios[i] * 1000000))) / BigInt(Math.floor(totalRatio * 1000000));\n results.push(share);\n remainder -= share;\n }\n\n // Last allocation gets the remainder to ensure exact sum\n results.push(remainder);\n return results;\n }\n\n // Handle number type\n const results: number[] = [];\n let remainder = amount;\n\n for (let i = 0; i < ratios.length - 1; i++) {\n const share = Math.floor((amount * ratios[i]) / totalRatio);\n results.push(share);\n remainder -= share;\n }\n\n // Last allocation gets the remainder to ensure exact sum\n results.push(remainder);\n return results;\n}\n"],"names":["allocate","amount","ratios","r","totalRatio","sum","ratio","results","remainder","i","share"],"mappings":"gFAuBO,SAASA,EAASC,EAAyBC,EAAuC,CACvF,GAAIA,EAAO,SAAW,EACpB,MAAM,IAAI,MAAM,8BAA8B,EAGhD,GAAIA,EAAO,KAAMC,GAAMA,EAAI,CAAC,EAC1B,MAAM,IAAI,MAAM,6BAA6B,EAG/C,MAAMC,EAAaF,EAAO,OAAO,CAACG,EAAKC,IAAUD,EAAMC,EAAO,CAAC,EAE/D,GAAIF,IAAe,EACjB,MAAM,IAAI,MAAM,4BAA4B,EAG9C,GAAI,OAAOH,GAAW,SAAU,CAC9B,MAAMM,EAAoB,CAAA,EAC1B,IAAIC,EAAYP,EAEhB,QAASQ,EAAI,EAAGA,EAAIP,EAAO,OAAS,EAAGO,IAAK,CAC1C,MAAMC,EAAST,EAAS,OAAO,KAAK,MAAMC,EAAOO,CAAC,EAAI,GAAO,CAAC,EAAK,OAAO,KAAK,MAAML,EAAa,GAAO,CAAC,EAC1GG,EAAQ,KAAKG,CAAK,EAClBF,GAAaE,CACf,CAGAH,OAAAA,EAAQ,KAAKC,CAAS,EACfD,CACT,CAGA,MAAMA,EAAoB,CAAA,EAC1B,IAAIC,EAAYP,EAEhB,QAASQ,EAAI,EAAGA,EAAIP,EAAO,OAAS,EAAGO,IAAK,CAC1C,MAAMC,EAAQ,KAAK,MAAOT,EAASC,EAAOO,CAAC,EAAKL,CAAU,EAC1DG,EAAQ,KAAKG,CAAK,EAClBF,GAAaE,CACf,CAGA,OAAAH,EAAQ,KAAKC,CAAS,EACfD,CACT"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function f(o, t) {
|
|
2
|
+
if (t.length === 0)
|
|
3
|
+
throw new Error("Ratios array cannot be empty");
|
|
4
|
+
if (t.some((e) => e < 0))
|
|
5
|
+
throw new Error("Ratios must be non-negative");
|
|
6
|
+
const n = t.reduce((e, r) => e + r, 0);
|
|
7
|
+
if (n === 0)
|
|
8
|
+
throw new Error("Total ratio cannot be zero");
|
|
9
|
+
if (typeof o == "bigint") {
|
|
10
|
+
const e = [];
|
|
11
|
+
let r = o;
|
|
12
|
+
for (let h = 0; h < t.length - 1; h++) {
|
|
13
|
+
const i = o * BigInt(Math.floor(t[h] * 1e6)) / BigInt(Math.floor(n * 1e6));
|
|
14
|
+
e.push(i), r -= i;
|
|
15
|
+
}
|
|
16
|
+
return e.push(r), e;
|
|
17
|
+
}
|
|
18
|
+
const l = [];
|
|
19
|
+
let s = o;
|
|
20
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
21
|
+
const r = Math.floor(o * t[e] / n);
|
|
22
|
+
l.push(r), s -= r;
|
|
23
|
+
}
|
|
24
|
+
return l.push(s), l;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
f as allocate
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=allocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allocate.js","sources":["../../src/math/allocate.ts"],"sourcesContent":["/**\n * Distributes an amount proportionally according to given ratios.\n * Handles rounding to ensure the sum equals the original amount exactly.\n * Critical for financial operations like splitting payments to avoid rounding errors.\n *\n * @example\n * ```ts\n * // Split $100 in ratio 1:2:3\n * allocate(100, [1, 2, 3]);\n * // [17, 33, 50] - sum is exactly 100\n *\n * // Split with bigint (e.g., cents)\n * allocate(10000n, [1, 1, 1]);\n * // [3334n, 3333n, 3333n] - sum is exactly 10000n\n * ```\n *\n * @param amount - Total amount to allocate\n * @param ratios - Array of ratios for distribution\n * @returns Array of allocated amounts (sum equals original amount)\n * @throws {Error} If ratios array is empty or contains negative values\n */\nexport function allocate(amount: number, ratios: number[]): number[];\nexport function allocate(amount: bigint, ratios: number[]): bigint[];\nexport function allocate(amount: number | bigint, ratios: number[]): (number | bigint)[] {\n if (ratios.length === 0) {\n throw new Error('Ratios array cannot be empty');\n }\n\n if (ratios.some((r) => r < 0)) {\n throw new Error('Ratios must be non-negative');\n }\n\n const totalRatio = ratios.reduce((sum, ratio) => sum + ratio, 0);\n\n if (totalRatio === 0) {\n throw new Error('Total ratio cannot be zero');\n }\n\n if (typeof amount === 'bigint') {\n const results: bigint[] = [];\n let remainder = amount;\n\n for (let i = 0; i < ratios.length - 1; i++) {\n const share = (amount * BigInt(Math.floor(ratios[i] * 1000000))) / BigInt(Math.floor(totalRatio * 1000000));\n results.push(share);\n remainder -= share;\n }\n\n // Last allocation gets the remainder to ensure exact sum\n results.push(remainder);\n return results;\n }\n\n // Handle number type\n const results: number[] = [];\n let remainder = amount;\n\n for (let i = 0; i < ratios.length - 1; i++) {\n const share = Math.floor((amount * ratios[i]) / totalRatio);\n results.push(share);\n remainder -= share;\n }\n\n // Last allocation gets the remainder to ensure exact sum\n results.push(remainder);\n return results;\n}\n"],"names":["allocate","amount","ratios","r","totalRatio","sum","ratio","results","remainder","i","share"],"mappings":"AAuBO,SAASA,EAASC,GAAyBC,GAAuC;AACvF,MAAIA,EAAO,WAAW;AACpB,UAAM,IAAI,MAAM,8BAA8B;AAGhD,MAAIA,EAAO,KAAK,CAACC,MAAMA,IAAI,CAAC;AAC1B,UAAM,IAAI,MAAM,6BAA6B;AAG/C,QAAMC,IAAaF,EAAO,OAAO,CAACG,GAAKC,MAAUD,IAAMC,GAAO,CAAC;AAE/D,MAAIF,MAAe;AACjB,UAAM,IAAI,MAAM,4BAA4B;AAG9C,MAAI,OAAOH,KAAW,UAAU;AAC9B,UAAMM,IAAoB,CAAA;AAC1B,QAAIC,IAAYP;AAEhB,aAASQ,IAAI,GAAGA,IAAIP,EAAO,SAAS,GAAGO,KAAK;AAC1C,YAAMC,IAAST,IAAS,OAAO,KAAK,MAAMC,EAAOO,CAAC,IAAI,GAAO,CAAC,IAAK,OAAO,KAAK,MAAML,IAAa,GAAO,CAAC;AAC1GG,MAAAA,EAAQ,KAAKG,CAAK,GAClBF,KAAaE;AAAA,IACf;AAGAH,WAAAA,EAAQ,KAAKC,CAAS,GACfD;AAAAA,EACT;AAGA,QAAMA,IAAoB,CAAA;AAC1B,MAAIC,IAAYP;AAEhB,WAASQ,IAAI,GAAGA,IAAIP,EAAO,SAAS,GAAGO,KAAK;AAC1C,UAAMC,IAAQ,KAAK,MAAOT,IAASC,EAAOO,CAAC,IAAKL,CAAU;AAC1D,IAAAG,EAAQ,KAAKG,CAAK,GAClBF,KAAaE;AAAA,EACf;AAGA,SAAAH,EAAQ,KAAKC,CAAS,GACfD;AACT;"}
|
package/dist/math/average.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./sum.cjs");function u(e,n){if(e.length===0)return;if((n?n(e[0]):e[0])instanceof Date){const t=e.reduce((i,o)=>{const r=n?n(o):o;if(!(r instanceof Date))throw new TypeError("average expected all items to be Date objects");return i+r.getTime()},0);return new Date(t/e.length)}try{const t=s.sum(e,n);if(typeof t=="number")return t/e.length}catch(t){if(t instanceof TypeError)return;throw t}}exports.average=u;
|
|
2
2
|
//# sourceMappingURL=average.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"average.cjs","sources":["../../src/math/average.ts"],"sourcesContent":["import { sum } from './sum';\n\n/**\n * Calculates the average of an array of numbers or dates.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * average(arr); // 3\n * average(arr, (num) => num * 2); // 6\n * average(arr, (num) => new Date(Date.now() + 1000 * 60 * 60 * 24 * num); // Date object representing 3 days from now\n * ```\n *\n * @param array - The array of numbers or dates to average.\n * @param callback - (optional) A callback function to map the values.\n * @returns The average of the numbers or dates in the array.\n */\n\nexport function average<T>(array: T[], callback?: (item: T) => number | Date): number | Date | undefined {\n if (array.length === 0) return undefined;\n
|
|
1
|
+
{"version":3,"file":"average.cjs","sources":["../../src/math/average.ts"],"sourcesContent":["import { sum } from './sum';\n\n/**\n * Calculates the average of an array of numbers or dates.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4, 5];\n * average(arr); // 3\n * average(arr, (num) => num * 2); // 6\n * average(arr, (num) => new Date(Date.now() + 1000 * 60 * 60 * 24 * num); // Date object representing 3 days from now\n * ```\n *\n * @param array - The array of numbers or dates to average.\n * @param callback - (optional) A callback function to map the values.\n * @returns The average of the numbers or dates in the array.\n */\n\nexport function average<T>(array: T[], callback?: (item: T) => number | Date): number | Date | undefined {\n if (array.length === 0) return undefined;\n\n // Check if we are dealing with Dates (either directly or via callback)\n const firstItem = callback ? callback(array[0]) : array[0];\n const isDate = firstItem instanceof Date;\n\n if (isDate) {\n const totalTimestamp = array.reduce<number>((acc, item) => {\n const val = callback ? callback(item) : item;\n if (!(val instanceof Date)) {\n throw new TypeError('average expected all items to be Date objects');\n }\n return acc + val.getTime();\n }, 0);\n return new Date(totalTimestamp / array.length);\n }\n\n // Handle numbers\n try {\n const total = sum(array, callback as (item: T) => number);\n if (typeof total === 'number') {\n return total / array.length;\n }\n } catch (err) {\n if (err instanceof TypeError) return undefined;\n throw err;\n }\n\n return undefined;\n}\n"],"names":["average","array","callback","totalTimestamp","acc","item","val","total","sum","err"],"mappings":"6GAkBO,SAASA,EAAWC,EAAYC,EAAkE,CACvG,GAAID,EAAM,SAAW,EAAG,OAMxB,IAHkBC,EAAWA,EAASD,EAAM,CAAC,CAAC,EAAIA,EAAM,CAAC,aACrB,KAExB,CACV,MAAME,EAAiBF,EAAM,OAAe,CAACG,EAAKC,IAAS,CACzD,MAAMC,EAAMJ,EAAWA,EAASG,CAAI,EAAIA,EACxC,GAAI,EAAEC,aAAe,MACnB,MAAM,IAAI,UAAU,+CAA+C,EAErE,OAAOF,EAAME,EAAI,QAAA,CACnB,EAAG,CAAC,EACJ,OAAO,IAAI,KAAKH,EAAiBF,EAAM,MAAM,CAC/C,CAGA,GAAI,CACF,MAAMM,EAAQC,EAAAA,IAAIP,EAAOC,CAA+B,EACxD,GAAI,OAAOK,GAAU,SACnB,OAAOA,EAAQN,EAAM,MAEzB,OAASQ,EAAK,CACZ,GAAIA,aAAe,UAAW,OAC9B,MAAMA,CACR,CAGF"}
|
package/dist/math/average.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { sum as
|
|
2
|
-
function
|
|
1
|
+
import { sum as s } from "./sum.js";
|
|
2
|
+
function p(t, n) {
|
|
3
3
|
if (t.length === 0) return;
|
|
4
|
-
|
|
4
|
+
if ((n ? n(t[0]) : t[0]) instanceof Date) {
|
|
5
|
+
const e = t.reduce((i, o) => {
|
|
6
|
+
const r = n ? n(o) : o;
|
|
7
|
+
if (!(r instanceof Date))
|
|
8
|
+
throw new TypeError("average expected all items to be Date objects");
|
|
9
|
+
return i + r.getTime();
|
|
10
|
+
}, 0);
|
|
11
|
+
return new Date(e / t.length);
|
|
12
|
+
}
|
|
5
13
|
try {
|
|
6
|
-
e =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
const e = s(t, n);
|
|
15
|
+
if (typeof e == "number")
|
|
16
|
+
return e / t.length;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
if (e instanceof TypeError) return;
|
|
19
|
+
throw e;
|
|
10
20
|
}
|
|
11
|
-
if (typeof e == "number")
|
|
12
|
-
return e / t.length;
|
|
13
|
-
if (e instanceof Date)
|
|
14
|
-
return new Date(e.getTime() / t.length);
|
|
15
21
|
}
|
|
16
22
|
export {
|
|
17
|
-
|
|
23
|
+
p as average
|
|
18
24
|
};
|
|
19
25
|
//# sourceMappingURL=average.js.map
|