Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 1.13 KB

File metadata and controls

65 lines (40 loc) · 1.13 KB

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