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
- If provided a
String
object, the function returnstrue
.var bool = isString( new String( 'beep' ) ); // returns true
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