1.0.4 โ€ข Published 7 months ago

@gledyson/factorialjs v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

๐Ÿ“ฆ @gledyson/factorialjs

Simple function to calculate the factorial of non-negative integers in JavaScript.

๐Ÿ”ง Installation

Use npm to install:

npm install @gledyson/factorialjs

๐Ÿš€ Usage

Importing the module

const factorial = require('@gledyson/factorialjs');

Examples

console.log(factorial(0));   // 1
console.log(factorial(1));   // 1
console.log(factorial(5));   // 120
console.log(factorial(10));  // 3628800

Invalid cases

console.log(factorial(-3));      // NaN
console.log(factorial("texto")); // NaN

*The function only accepts non-negative integers. Any invalid input will return NaN.

๐Ÿงช Running the tests

To run the tests, simply use:

npm test

๐Ÿ“„ License MIT ยฉ Gledyson Ferreira dos Santos

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago