UNPKG

@tsdotnet/linq

Version:

A familiar set of functions that operate on JavaScript iterables (ES2015+) in a similar way to .NET's LINQ does with enumerables.

17 lines (14 loc) 357 B
import { ArgumentNullException } from '@tsdotnet/exceptions'; function sum(sequence) { if (!sequence) throw new ArgumentNullException('sequence'); let sum = 0; for (const s of sequence) { if (isNaN(s)) return NaN; sum += s; } return sum; } export { sum as default }; //# sourceMappingURL=sum.js.map