UNPKG

ngx-easy-d3

Version:

Build an Angular library compatible with AoT compilation and Tree shaking like an official package

23 lines (18 loc) 404 B
import { Injectable } from '@angular/core'; @Injectable() export class SumService { /** * Stores the last sum. */ public sum: number; /** * Calculates the sum. * @param addends Numbers to be added */ public calculate(...addends: number[]): void { this.sum = 0; for (const addend of addends) { this.sum += addend; } } }