Package Exports
- is-natural-number-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-natural-number-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-natural-number-string
Check if a given value is a string that represents natural number
isNaturalNumberString('9478123289889839898438984843498934894'); //=> true
isNaturalNumberString('-1'); //=> 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
isNaturalNumberString('15'); //=> true
isNaturalNumberString('4.3'); //=> false
isNaturalNumberString('1'); //=> true
isNaturalNumberString('1.0'); //=> true
isNaturalNumberString('1.00000000000000000000000000'); //=> true
// non-string
isNaturalNumberString(15); //=> false
isNaturalNumberString(); //=> false
option.includeZero
Type: Boolean
Default: false
Determine whether this library regards 0
as a natural number or not.
isNaturalNumberString('0'); //=> false
isNaturalNumberString('0', {includeZero: true}); //=> true
License
Copyright (c) 2016 Shinnosuke Watanabe
Licensed under the MIT License.