Identity Function

Identity function.

Usage

var identity = require( '@stdlib/utils/identity-function' );

identity( x )

Returns x.

var v = identity( 3.14 );
// returns 3.14

var input = [];
var output = identity( input );
var bool = ( input === output );
// returns true

Examples

var identity = require( '@stdlib/utils/identity-function' );

var v = identity( 3.14 );
// returns 3.14

v = identity( true );
// returns true

v = identity( null );
// returns null

v = identity( void 0 );
// returns undefined

v = identity();
// returns undefined
Did you find this page helpful?