Functional Weave
Code in TypeScript

money.sum@1.0.0

impl/typescript.ts

276 bytes · the TypeScript implementation · view raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

import { type Money, money } from "./money_amount.ts";  ← from money.amount ^1.0.0 · built alongside by fune
import { addMoney } from "./money_add.ts";  ← from money.add ^1.0.0 · built alongside by fune

export function sumMoney(amounts: readonly Money[], currency: string): Money {
  return amounts.reduce<Money>((total, amount) => addMoney(total, amount), money(0, currency));
}