extra-math 1.3.21 โ†’ 1.3.22

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.
Files changed (2) hide show
  1. package/index.d.ts +87 -29
  2. package/package.json +4 -3
package/index.d.ts CHANGED
@@ -1,196 +1,254 @@
1
1
  /**
2
2
  * Find the remainder of x/y with sign of x (truncated division).
3
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/rem)
3
4
  * @param x dividend
4
5
  * @param y divisor
5
6
  * @returns trunc(x/y)
6
- */
7
+ * */
8
+
7
9
  declare function rem(x: number, y: number): number;
8
10
  /**
9
11
  * Find the remainder of x/y with sign of y (floored division).
12
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/mod)
10
13
  * @param x dividend
11
14
  * @param y divisor
12
15
  * @returns floor(x/y)
13
- */
16
+ * */
17
+
14
18
  declare function mod(x: number, y: number): number;
15
19
  /**
16
20
  * Find the remainder of x/y with +ve sign (euclidean division).
21
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/modp)
17
22
  * @param x dividend
18
23
  * @param y divisor
19
24
  * @returns n>0: floor(x/y), n<0: ceil(x/y)
20
- */
25
+ * */
26
+
21
27
  declare function modp(x: number, y: number): number;
22
28
  /**
23
29
  * Find the greatest common divisor of numbers.
30
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/gcd)
24
31
  * @param xs a list of numbers
25
32
  * @returns gcd(xโ‚, xโ‚‚, ...)
26
- */
33
+ * */
34
+
27
35
  declare function gcd(...xs: number[]): number;
28
36
 
29
37
  /**
30
38
  * Find the least common multiple of numbers.
39
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/lcm)
31
40
  * @param xs a list of numbers
32
41
  * @returns lcm(xโ‚, xโ‚‚, ...)
33
- */
42
+ * */
43
+
34
44
  declare function lcm(...xs: number[]): number;
35
45
  /**
36
46
  * Find the factorial of a number.
47
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/factorial)
37
48
  * @param n a number
38
49
  * @param k denominator factorial [0]
39
50
  * @returns P(n, k); k=0: n!, k>0: n!/k!
40
- */
51
+ * */
52
+
41
53
  declare function factorial(n: number, k?: number): number;
42
54
  /**
43
55
  * Find the number of ways to choose k elements from a set of n elements.
56
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/binomial)
44
57
  * @param n elements in source set
45
58
  * @param k elements in choose set
46
59
  * @returns C(n, k)
47
- */
60
+ * */
61
+
48
62
  declare function binomial(n: number, k: number): number;
49
63
  /**
50
64
  * Find the number of ways to put n objects in m bins (n=sum(kแตข)).
65
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/multinomial)
51
66
  * @param ks objects per bin (kแตข)
52
67
  * @returns n!/(kโ‚!kโ‚‚!...) | n=sum(kแตข)
53
- */
68
+ * */
69
+
54
70
  declare function multinomial(...ks: number[]): number;
55
71
  /**
56
72
  * Constrain a number within a minimum and a maximum value.
73
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/constrain)
57
74
  * @param x a number
58
75
  * @param min minimum value
59
76
  * @param max maximum value
60
77
  * @returns x<min: min, x>max: max, x
61
- */
78
+ * */
79
+
62
80
  declare function constrain(x: number, min: number, max: number): number;
63
81
 
64
82
  /**
65
83
  * Normalize a number from its current range into a value between 0 and 1.
84
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/norm)
66
85
  * @param x a number
67
86
  * @param r lower bound of current range
68
87
  * @param R upper bound of current range
69
88
  * @returns โˆˆ [0, 1]
70
- */
89
+ * */
90
+
71
91
  declare function norm(x: number, r: number, R: number): number;
72
92
  /**
73
93
  * Re-map a number from one range to another.
94
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/map)
74
95
  * @param x a number
75
96
  * @param r lower bound of current range
76
97
  * @param R upper bound of current range
77
98
  * @param t lower bound of target range
78
99
  * @param T upper bound of target range
79
100
  * @returns โˆˆ [ymin, ymax]
80
- */
101
+ * */
102
+
81
103
  declare function map(x: number, r: number, R: number, t: number, T: number): number;
82
104
  /**
83
105
  * Linearly interpolate a number between two numbers.
106
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/lerp)
84
107
  * @param x start number
85
108
  * @param y stop number
86
109
  * @param t interpolant โˆˆ [0, 1]
87
110
  * @returns โˆˆ [x, y]
88
- */
111
+ * */
112
+
89
113
  declare function lerp(x: number, y: number, t: number): number;
90
114
  /**
91
115
  * Find the nth root of a number (โฟโˆš).
116
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/root)
92
117
  * @param x a number
93
118
  * @param n root
94
119
  * @returns โฟโˆšx
95
- */
120
+ * */
121
+
96
122
  declare function root(x: number, n: number): number;
97
123
  /**
98
124
  * Find the logarithm of a number with a given base.
125
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/log)
99
126
  * @param x a number
100
127
  * @param b logarithm base [e]
101
128
  * @returns log_b (x)
102
- */
129
+ * */
130
+
103
131
  declare function log(x: number, b?: number): number;
104
132
  /**
105
133
  * Compute the gamma function of a number (ฮ“).
134
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/gamma)
106
135
  * @param x a number
107
136
  * @returns ฮ“(x); for +ve integer ฮ“(x) = x!
108
- */
137
+ * */
138
+
109
139
  declare function gamma(x: number): number;
110
140
  /**
111
141
  * Compute the natural logarithm of the absolute value of the gamma function of a number (log-ฮ“).
142
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/lgamma)
112
143
  * @param x a number
113
144
  * @returns log(|ฮ“(x)|)
114
- */
145
+ * */
146
+
115
147
  declare function lgamma(x: number): number;
116
148
  /**
117
149
  * Find error function value of number (approximation).
150
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/erf)
118
151
  * @param x a number
119
152
  * @returns erf(x)
120
- */
153
+ * */
154
+
121
155
  declare function erf(x: number): number;
122
156
  /**
123
157
  * Find the complementary error function value of number (approximation).
158
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/erfc)
124
159
  * @param x a number
125
160
  * @returns erfc(x)
126
- */
161
+ * */
162
+
127
163
  declare function erfc(x: number): number;
128
164
  /**
129
165
  * Convert radians to degrees.
166
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/degrees)
130
167
  * @param x radians
131
168
  * @returns 2ฯ€ โ†’ 360
132
- */
169
+ * */
170
+
133
171
  declare function degrees(x: number): number;
134
172
  /**
135
173
  * Convert degrees to radians.
174
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/radians)
136
175
  * @param x degrees
137
176
  * @returns 360 โ†’ 2ฯ€
138
- */
177
+ * */
178
+
139
179
  declare function radians(x: number): number;
140
180
  /**
141
181
  * Calculate the magnitude (length) of a vector.
182
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/magnitude)
142
183
  * @param xs vector ([x, y, z, ...])
143
184
  * @returns โˆš(xยฒ + yยฒ + zยฒ)
144
- */
185
+ * */
186
+
145
187
  declare function magnitude(xs: number[]): number;
146
188
  /**
147
189
  * Calculate the distance between two points.
190
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/distance)
148
191
  * @param xs first point ([x, y, z, ...])
149
192
  * @param ys second point ([x, y, z, ...])
150
193
  * @returns โˆš(ฮ”xยฒ + ฮ”yยฒ + ฮ”zยฒ)
151
- */
194
+ * */
195
+
152
196
  declare function distance(xs: number[], ys: number[]): number;
153
197
  /**
154
198
  * Find the sum of numbers (ฮฃ).
199
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/sum)
155
200
  * @param xs a list of numbers
156
201
  * @returns ฮฃxแตข
157
- */
202
+ * */
203
+
158
204
  declare function sum(...xs: number[]): number;
159
205
  /**
160
206
  * Find the product of numbers (โˆ).
207
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/product)
161
208
  * @param xs a list of numbers
162
209
  * @returns โˆxแตข
163
- */
210
+ * */
211
+
164
212
  declare function product(...xs: number[]): number;
165
213
  /**
166
214
  * Find the average of numbers.
215
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/mean)
167
216
  * @param xs a list of numbers
168
217
  * @returns ฮฃxแตข/n | n = size(xs)
169
- */
218
+ * */
219
+
170
220
  declare function mean(...xs: number[]): number;
171
221
  /**
172
222
  * Find the value separating the higher and lower halves of numbers.
223
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/median)
173
224
  * @param xs a list of numbers
174
225
  * @returns xโ‚˜ | sort(xs) = [..., xโ‚˜, ...]
175
- */
226
+ * */
227
+
176
228
  declare function median(...xs: number[]): number;
177
229
  /**
178
230
  * Find the values that appear most often.
231
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/modes)
179
232
  * @param xs a list of numbers
180
233
  * @returns [xโ‚˜โ‚, xโ‚˜โ‚‚, ...] | count(xโ‚˜แตข) โ‰ฅ count(xแตข) โˆ€ xแตข โˆˆ xs
181
- */
234
+ * */
235
+
182
236
  declare function modes(...xs: number[]): number[];
183
237
  /**
184
238
  * Find the difference between the largest and smallest values.
239
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/range)
185
240
  * @param xs a list of numbers
186
241
  * @returns max(xs) - min(xs)
187
- */
242
+ * */
243
+
188
244
  declare function range(...xs: number[]): number;
189
245
  /**
190
246
  * Find the mean of squared deviation of numbers from its mean.
247
+ * [๐Ÿ“˜](https://github.com/nodef/extra-math/wiki/variance)
191
248
  * @param xs a list of numbers
192
249
  * @returns ฯƒยฒ = E[(xs - ยต)ยฒ] | ยต = mean(xs)
193
- */
250
+ * */
251
+
194
252
  declare function variance(...xs: number[]): number;
195
253
 
196
254
  export { binomial, constrain as clamp, constrain, degrees, distance, erf, erfc, factorial, gamma, gcd, gcd as hcf, lcm, lerp, lgamma, log, magnitude, map, mean, median, mod, modes, modp, multinomial, norm, product, radians, range, rem, root, sum, variance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extra-math",
3
- "version": "1.3.21",
3
+ "version": "1.3.22",
4
4
  "description": "A collection of common mathematical functions.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -12,7 +12,8 @@
12
12
  "scripts": {
13
13
  "test": "exit",
14
14
  "build": "node ./build",
15
- "deploy": "node ./build deploy"
15
+ "publish-docs": "node ./build publish-docs",
16
+ "publish-packages": "node ./build publish-packages"
16
17
  },
17
18
  "keywords": [
18
19
  "extra",
@@ -62,7 +63,7 @@
62
63
  "devDependencies": {
63
64
  "@rollup/plugin-commonjs": "^22.0.1",
64
65
  "@rollup/plugin-node-resolve": "^13.3.0",
65
- "extra-build": "^2.1.31",
66
+ "extra-build": "^2.2.21",
66
67
  "rollup-plugin-cleanup": "^3.2.1",
67
68
  "rollup-plugin-dts": "^4.2.2"
68
69
  }