Native Function

Regular expression to match a native function.

Usage

var RE_NATIVE_FUNCTION = require( '@stdlib/regexp/native-function' );

RE_NATIVE_FUNCTION

Regular expression to match a native function.

var bool = RE_NATIVE_FUNCTION.test( Date.toString() );
// returns true

Examples

var RE_NATIVE_FUNCTION = require( '@stdlib/regexp/native-function' );

function isNativeFunction( fcn ) {
    return RE_NATIVE_FUNCTION.test( fcn.toString() );
}

var bool = isNativeFunction( Math.sqrt );
// returns true

bool = isNativeFunction( String );
// returns true

bool = isNativeFunction( Int8Array );
// returns true

bool = isNativeFunction( Date );
// returns true

bool = isNativeFunction( function noop() {} );
// returns false