'use strict';

// MODULES //

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


// FUNCTIONS //

// Using `Function#toString` bypasses a value's own `toString` method to provide an extra, but not security proof, precaution to prevent a provided function from impersonating a native function:
var fcn2str = Function.prototype.toString;


// MAIN //

/**
* Tests if a value is a native function.
*
* @param {*} value - value to test
* @returns {boolean} boolean indicating whether value is a native function
*
* @example
* function beep() {
*     console.log( 'boop' );
* }
*
* var bool = isNativeFunction( beep );
* // returns false
*
* bool = isNativeFunction( Date );
* // returns true

*/
function isNativeFunction( value ) {
	return (
		isFunction( value ) &&
		RE_NATIVE_FUNCTION.test( fcn2str.call( value ) )
	);
} // end FUNCTION isNativeFunction()


// EXPORTS //

module.exports = isNativeFunction;

'use strict';

// MODULES //

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


// FUNCTIONS //

// Using `Function#toString` bypasses a value's own `toString` method to provide an extra, but not security proof, precaution to prevent a provided function from impersonating a native function:
var fcn2str = Function.prototype.toString;


// MAIN //

/**
* Tests if a value is a native function.
*
* @param {*} value - value to test
* @returns {boolean} boolean indicating whether value is a native function
*
* @example
* function beep() {
*     console.log( 'boop' );
* }
*
* var bool = isNativeFunction( beep );
* // returns false
*
* bool = isNativeFunction( Date );
* // returns true
*/
function isNativeFunction( value ) {
	return (
		isFunction( value ) &&
		RE_NATIVE_FUNCTION.test( fcn2str.call( value ) )
	);
} // end FUNCTION isNativeFunction()


// EXPORTS //

module.exports = isNativeFunction;

Remove empty line