1.0.0 • Published 7 years ago
sum-digit v1.0.0
sum-digit
Sum the digits of a number.
Features
Install
npm install --save sum-digit
Usage
const sumDigit = require('sum-digit');
sumDigit(123);
//=> 6
sumDigit(32581);
//=> 19
sumDigit('123');
//=> 6
sumDigit('123x');
//=> NaN
sumDigit(); // without parameter this function will throw a type error
//=> TypeError: expects Numeric value got undefined
Author
Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
License
- MIT
1.0.0
7 years ago