Test if a value is a string.
var isString = require( '@stdlib/utils/is-string' );
Tests if a value is a string
.
var bool = isString( 'beep' );
// returns true
bool = isString( new String( 'beep' ) );
// returns true
Tests if a value
is a primitive string
.
var bool = isString.isPrimitive( 'beep' );
// returns true
bool = isString.isPrimitive( new String( 'boop' ) );
// returns false
Tests if a value
is a String
object.
var bool = isString.isObject( 'beep' );
// returns false
bool = isString.isObject( new String( 'boop' ) );
// returns true
Tests if a value
is a string array
.
var bool = isString.isStringArray( [ 'beep', new String('boop') ] );
// returns true
bool = isString.isStringArray( [ 'beep', null ] );
// returns false
Tests if a value
is a primitive string array
.
var bool = isString.isPrimitiveStringArray( [ 'beep', 'boop' ] );
// returns true
bool = isString.isPrimitiveStringArray( [ 'beep', new String('boop') ] );
// returns false
var isString = require( '@stdlib/utils/is-string' );
console.log( isString( 'beep' ) );
// returns true
console.log( isString( new String( 'beep' ) ) );
// returns true
console.log( isString( 5 ) );
// returns false
console.log( isString( null ) );
// returns false
console.log( isString( undefined ) );
// returns false
console.log( isString( {} ) );
// returns false
console.log( isString( [] ) );
// returns false
console.log( isString( function foo(){} ) );
// returns false