es-toolkit
Advanced tools
Comparing version
@@ -40,2 +40,3 @@ export { chunk } from './array/chunk.js'; | ||
export { clamp } from './math/clamp.js'; | ||
export { mean } from './math/mean.js'; | ||
export { random } from './math/random.js'; | ||
@@ -42,0 +43,0 @@ export { randomInt } from './math/randomInt.js'; |
@@ -59,2 +59,3 @@ "use strict"; | ||
maxBy: () => maxBy, | ||
mean: () => mean, | ||
minBy: () => minBy, | ||
@@ -471,2 +472,16 @@ noop: () => noop, | ||
// src/math/sum.ts | ||
function sum(nums) { | ||
let result = 0; | ||
for (const num of nums) { | ||
result += num; | ||
} | ||
return result; | ||
} | ||
// src/math/mean.ts | ||
function mean(nums) { | ||
return sum(nums) / nums.length; | ||
} | ||
// src/math/random.ts | ||
@@ -494,11 +509,2 @@ function random(minimum, maximum) { | ||
// src/math/sum.ts | ||
function sum(nums) { | ||
let result = 0; | ||
for (const num of nums) { | ||
result += num; | ||
} | ||
return result; | ||
} | ||
// src/math/range.ts | ||
@@ -627,2 +633,3 @@ function range(start, end, step) { | ||
maxBy, | ||
mean, | ||
minBy, | ||
@@ -629,0 +636,0 @@ noop, |
export { clamp } from './clamp.js'; | ||
export { mean } from './mean.js'; | ||
export { random } from './random.js'; | ||
@@ -3,0 +4,0 @@ export { randomInt } from './randomInt.js'; |
@@ -24,2 +24,3 @@ "use strict"; | ||
clamp: () => clamp, | ||
mean: () => mean, | ||
random: () => random, | ||
@@ -41,2 +42,16 @@ randomInt: () => randomInt, | ||
// src/math/sum.ts | ||
function sum(nums) { | ||
let result = 0; | ||
for (const num of nums) { | ||
result += num; | ||
} | ||
return result; | ||
} | ||
// src/math/mean.ts | ||
function mean(nums) { | ||
return sum(nums) / nums.length; | ||
} | ||
// src/math/random.ts | ||
@@ -64,11 +79,2 @@ function random(minimum, maximum) { | ||
// src/math/sum.ts | ||
function sum(nums) { | ||
let result = 0; | ||
for (const num of nums) { | ||
result += num; | ||
} | ||
return result; | ||
} | ||
// src/math/range.ts | ||
@@ -96,2 +102,3 @@ function range(start, end, step) { | ||
clamp, | ||
mean, | ||
random, | ||
@@ -98,0 +105,0 @@ randomInt, |
@@ -14,4 +14,4 @@ /** | ||
*/ | ||
declare function sum(nums: number[]): number; | ||
declare function sum(nums: readonly number[]): number; | ||
export { sum }; |
{ | ||
"name": "es-toolkit", | ||
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.", | ||
"version": "1.5.0-dev.106+0c9afc27", | ||
"version": "1.5.0-dev.107+715bc60b", | ||
"workspaces": [ | ||
@@ -6,0 +6,0 @@ "docs" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
568626
1.14%506
1.61%6198
1.56%