Commit 58fe2bb
docs: Document current string concatenation behavior in sum methods (lodash#5818)
Update JSDoc and add tests to document the current behavior where non-numeric
values in sum/sumBy/mean/meanBy result in string concatenation rather than
numeric addition.
This documents the existing behavior as reported in lodash#5818. The behavior may
change in a future major version (see lodash#6095 for the proposed fix).
Changes:
- Update JSDoc for sum, sumBy, mean, meanBy to note string concatenation behavior
- Update @returns to reflect that string may be returned
- Add examples showing the non-numeric behavior
- Add tests documenting string concatenation with various non-numeric inputs
- Reference lodash#5818 in documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 62b439f commit 58fe2bb
2 files changed
+50
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16450 | 16450 | | |
16451 | 16451 | | |
16452 | 16452 | | |
| 16453 | + | |
| 16454 | + | |
| 16455 | + | |
| 16456 | + | |
| 16457 | + | |
16453 | 16458 | | |
16454 | 16459 | | |
16455 | 16460 | | |
16456 | 16461 | | |
16457 | 16462 | | |
16458 | | - | |
| 16463 | + | |
16459 | 16464 | | |
16460 | 16465 | | |
16461 | 16466 | | |
| |||
16470 | 16475 | | |
16471 | 16476 | | |
16472 | 16477 | | |
| 16478 | + | |
| 16479 | + | |
| 16480 | + | |
| 16481 | + | |
| 16482 | + | |
16473 | 16483 | | |
16474 | 16484 | | |
16475 | 16485 | | |
16476 | 16486 | | |
16477 | 16487 | | |
16478 | 16488 | | |
16479 | | - | |
| 16489 | + | |
16480 | 16490 | | |
16481 | 16491 | | |
16482 | 16492 | | |
| |||
16609 | 16619 | | |
16610 | 16620 | | |
16611 | 16621 | | |
| 16622 | + | |
| 16623 | + | |
| 16624 | + | |
| 16625 | + | |
| 16626 | + | |
| 16627 | + | |
16612 | 16628 | | |
16613 | 16629 | | |
16614 | 16630 | | |
16615 | 16631 | | |
16616 | 16632 | | |
16617 | | - | |
| 16633 | + | |
16618 | 16634 | | |
16619 | 16635 | | |
16620 | 16636 | | |
16621 | 16637 | | |
| 16638 | + | |
| 16639 | + | |
| 16640 | + | |
| 16641 | + | |
16622 | 16642 | | |
16623 | 16643 | | |
16624 | 16644 | | |
| |||
16631 | 16651 | | |
16632 | 16652 | | |
16633 | 16653 | | |
| 16654 | + | |
| 16655 | + | |
| 16656 | + | |
| 16657 | + | |
| 16658 | + | |
| 16659 | + | |
16634 | 16660 | | |
16635 | 16661 | | |
16636 | 16662 | | |
16637 | 16663 | | |
16638 | 16664 | | |
16639 | 16665 | | |
16640 | | - | |
| 16666 | + | |
16641 | 16667 | | |
16642 | 16668 | | |
16643 | 16669 | | |
| |||
16648 | 16674 | | |
16649 | 16675 | | |
16650 | 16676 | | |
| 16677 | + | |
| 16678 | + | |
| 16679 | + | |
| 16680 | + | |
16651 | 16681 | | |
16652 | 16682 | | |
16653 | 16683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21574 | 21574 | | |
21575 | 21575 | | |
21576 | 21576 | | |
| 21577 | + | |
| 21578 | + | |
| 21579 | + | |
| 21580 | + | |
| 21581 | + | |
| 21582 | + | |
| 21583 | + | |
| 21584 | + | |
| 21585 | + | |
| 21586 | + | |
| 21587 | + | |
| 21588 | + | |
| 21589 | + | |
| 21590 | + | |
| 21591 | + | |
| 21592 | + | |
21577 | 21593 | | |
21578 | 21594 | | |
21579 | 21595 | | |
| |||
0 commit comments