time-to-botec/js/node_modules/@stdlib/regexp/native-function
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

Native Function

Regular expression to match a native function.

Usage

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

reNativeFunction()

Returns a regular expression to match a native function.

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

reNativeFunction.REGEXP

Regular expression to match a native function.

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

Examples

var Int8Array = require( '@stdlib/array/int8' );
var reNativeFunction = require( '@stdlib/regexp/native-function' );

var RE_NATIVE_FUNCTION = reNativeFunction();
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