time-to-botec/js/node_modules/@stdlib/assert/is-digit-string/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.1 KiB

isDigitString

Test whether a string contains only numeric digits.

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

CLI

Usage

Usage: is-digit-string [options] [<string>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ is-digit-string 0123456789
true

To use as a standard stream,

$ echo -n '0123456789' | is-digit-string
true