Skip to content

Latest commit

 

History

History

is-string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

isString

Test if a value is a string.

Usage

var isString = require( '@stdlib/utils/is-string' );

isString( value )

Tests if a value is a string.

var bool = isString( 'beep' );
// returns true

Notes

  • If provided a String object, the function returns true.
    var bool = isString( new String( 'beep' ) );
    // returns true

Examples

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