Skip to content

Latest commit

 

History

History

is-localhost

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

isLocalhost

Test whether a value is a localhost hostname.

Usage

var isLocalhost = require( '@stdlib/assert/is-localhost' );

isLocalhost( value )

Tests whether a value is a localhost hostname.

var bool = isLocalhost( 'localhost' );
// returns true

bool = isLocalhost( 'stdlib.io' );
// returns false

Examples

var isLocalhost = require( '@stdlib/assert/is-localhost' );

var bool = isLocalhost( 'localhost' );
// returns true

bool = isLocalhost( '127.0.0.1' );
// returns true

bool = isLocalhost( '[::1]' );
// returns true

bool = isLocalhost( 'wikipedia.org' );
// returns false

bool = isLocalhost( 'stdlib.io' );
// returns false

bool = isLocalhost( null );
// returns false