3.0.1 • Published 6 years ago

dec-int v3.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

dec-int

Returns a base-10 integer from a NumericString or Number. Returns NaN if input can't be coerced to an integer.

decInt('56') // => 56

What is a NumericString?

Anything that would be a number if it didn't have quotes around it. For example, these are all numeric strings:

'5' or "5"
'123.456' or "123.456"
'-0' or "-0"
'0xFFFFFF' or "0xFFFFFF"
'020' or "020"

However, these are examples of what's not a NumericString:

"Infinity"
"Math.PI"
"PI"
"e"

Note: any input that is equivalent to negative-zero (except negative-zero itself) will evaluate to positive-zero. For example:

decInt(0); // => 0
decInt(-0); // => -0
decInt('-0'); // => 0
decInt('-0.5'); // => 0
3.0.1

6 years ago

3.0.0

6 years ago

2.0.1

8 years ago

1.0.0

9 years ago