digitsum
v0.0.2
Published
Sum the digits of a number.
Downloads
2
Readme
digitsum
Sum the digits of a number.
Install
npm install digitsum
bower install digit-sum
Usage
var digitSum = require('digitsum');
console.log(digitSum(1234)); // 10
console.log(digitSum(3890)); 20
console.log(digitSum(Infinity)); // Infinity
console.log(digitSum(-1234)); // 0
console.log(digitSum(-3890)); // 0
console.log(digitSum(-Infinity)); // 0
Test
npm test
License
MIT