es-toolkit 1.32.0-dev.1007 → 1.32.0-dev.1008

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.
@@ -2173,11 +2173,16 @@ function sumBy(array, iteratee$1) {
2173
2173
  if (iteratee$1 != null) {
2174
2174
  iteratee$1 = iteratee(iteratee$1);
2175
2175
  }
2176
- let result = iteratee$1 ? iteratee$1(array[0]) : array[0];
2177
- for (let i = 1; i < array.length; i++) {
2176
+ let result = undefined;
2177
+ for (let i = 0; i < array.length; i++) {
2178
2178
  const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
2179
2179
  if (current !== undefined) {
2180
- result += current;
2180
+ if (result === undefined) {
2181
+ result = current;
2182
+ }
2183
+ else {
2184
+ result += current;
2185
+ }
2181
2186
  }
2182
2187
  }
2183
2188
  return result;
@@ -7,11 +7,16 @@ function sumBy(array, iteratee$1) {
7
7
  if (iteratee$1 != null) {
8
8
  iteratee$1 = iteratee(iteratee$1);
9
9
  }
10
- let result = iteratee$1 ? iteratee$1(array[0]) : array[0];
11
- for (let i = 1; i < array.length; i++) {
10
+ let result = undefined;
11
+ for (let i = 0; i < array.length; i++) {
12
12
  const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
13
13
  if (current !== undefined) {
14
- result += current;
14
+ if (result === undefined) {
15
+ result = current;
16
+ }
17
+ else {
18
+ result += current;
19
+ }
15
20
  }
16
21
  }
17
22
  return result;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.32.0-dev.1007+9bc5fa98",
4
+ "version": "1.32.0-dev.1008+afc42f21",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {