time-to-botec/squiggle/node_modules/@stdlib/assert/is-string-array/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.3 KiB

isStringArray

Test if a value is an array of strings.

Usage

var isStringArray = require( '@stdlib/assert/is-string-array' );

isStringArray( value )

Tests if a value is an array of strings.

var bool = isStringArray( [ 'beep', new String('boop') ] );
// returns true

bool = isStringArray( [ 'beep', null ] );
// returns false

isStringArray.primitives( value )

Tests if a value is an array containing only string primitives.

var bool = isStringArray.primitives( [ 'beep', 'boop' ] );
// returns true

bool = isStringArray.primitives( [ 'beep', new String('boop') ] );
// returns false

isStringArray.objects( value )

Tests if a value is an array containing only String objects.

var bool = isStringArray.objects( [ new String('beep'), new String('boop') ] );
// returns true

bool = isStringArray.objects( [ 'beep', new String('boop') ] );
// returns false

Examples

var isStringArray = require( '@stdlib/assert/is-string-array' );

var bool = isStringArray( [ 'Hello World!' ] );
// returns true

bool = isStringArray( [ 'a', 'b', 'c' ] );
// returns true

bool = isStringArray( [ new String( 'abc' ), 'def', 'ghi' ] );
// returns true

bool = isStringArray( 'abc' );
// returns false

bool = isStringArray( [] );
// returns false

bool = isStringArray( [ 'a', NaN ] );
// returns false