@stdlib/assert-is-digit-string
v0.2.2
Published
Test whether a string contains only numeric digits.
Downloads
77
Readme
isDigitString
Test whether a string contains only numeric digits.
Installation
npm install @stdlib/assert-is-digit-string
Usage
var isDigitString = require( '@stdlib/assert-is-digit-string' );
isDigitString( value )
Tests whether a string contains only numeric digits.
var bool = isDigitString( '0123456789' );
// returns true
Notes
- For non-string values, the function returns
false
.
Examples
var isDigitString = require( '@stdlib/assert-is-digit-string' );
var out = isDigitString( '0123456789' );
// returns true
out = isDigitString( '' );
// returns false
out = isDigitString( '0xffffff' );
// returns false
out = isDigitString( 123 );
// returns false
See Also
@stdlib/assert-is-digit-string-cli
: CLI package for use as a command-line utility.@stdlib/assert-is-hex-string
: test whether a string contains only hexadecimal digits.@stdlib/assert-is-string
: test if a value is a string.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.