Skip to content

Commit

Permalink
adding comments to special generation codes
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleSound committed Jul 10, 2022
1 parent 8d6f84e commit fe25afe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/math/useSum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export function useSum<T>(

const reduceCallback = (sum: any, value: any, index: number) => adder(resolveUnref(sum), resolveUnref(value), index)

// Depending on the behavior of reduce, undefined is also a valid initialization value,
// and this code will distinguish the behavior between them.
return args.length
? reduce(reduceCallback, args[0])
: reduce(reduceCallback)
Expand Down

0 comments on commit fe25afe

Please sign in to comment.