digit-count
v1.0.3
Published
Count digits in a decimal number.
Downloads
4
Readme
Digit Counter
Counts the digits in a decimal number.
Installation
npm install digit-count
Usage
digit-count(1234); // returns 4
digit-count('1234'); // 4
digit-count(-1234); // 4, again
digit-count(1234.2232); // still returns 4
// but!
digit-count('abcd'); // throws a type error
Attribution
Adopted from Mwr247's elegant solution to this problem, which can be found here.