is-natural-number-string
Check if a given value is a string that represents natural number
; //=> true; //=> false
Unlike is-natural-number
, is-natural-number-string
can handle a too large number that exceeds the JavaScript maximum safe integer 9007199254740991
.
Installation
Package managers
npm
npm install is-natural-number-string
bower
bower install is-natural-number-string
Standalone
Download the script file directly.
API
isNaturalNumberString(val [, option])
val: String
option: Object
Return: Boolean
; //=> true; //=> false ; //=> true; //=> true; //=> true // non-string; //=> false; //=> false
option.includeZero
Type: Boolean
Default: false
Determine whether this library regards 0
as a natural number or not.
; //=> false; //=> true
License
Copyright (c) 2016 Shinnosuke Watanabe
Licensed under the MIT License.