1.0.0 • Published 1 year ago

@rabdya767/add-numbers v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

add_numbers

This is a TypeScript function that takes an array of numbers and returns their sum. If the array is empty, the function returns 0.

Usage

To use this function, first import it into your TypeScript code:

import { addNNumbers } from "./addNNumbers";

Then you can call the addNNumbers function with an array of numbers:

const numbers = [1, 2, 3, 4, 5];
const sum = addNNumbers(numbers); // sum is now 15

If you pass an empty array to the addNNumbers function, it will return 0:

const emptyArray = [];
const sum = addNNumbers(emptyArray); // sum is now 0

Tests

This function includes unit tests to verify its correctness. To run the tests, first install the necessary dependencies:

npm install

Then you can run the tests using the following command:

npm test

License

This code is released under the MIT License. Feel free to use it in your own projects or modify it as needed.

1.0.0

1 year ago