Use built-in `typeof` operator and add warning
'use strict';

// MODULES //

var isObjectLike = require( '@stdlib/utils/is-object-like' );


// IS BUFFER //

/**
* FUNCTION: isBuffer( value )
*	Tests if a value is a Buffer instance.
*
* @param {*} value - value to validate
* @returns {Boolean} boolean indicating if a value is a Buffer instance
*/
function isBuffer( value ) {
	return (
		isObjectLike( value ) &&
		(
			value._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)
			(
				value.constructor &&
				// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions
				typeof value.constructor.isBuffer === 'function' &&
				value.constructor.isBuffer( value )
			)
		)
	);
} // end FUNCTION isBuffer()


// EXPORTS //

module.exports = isBuffer;

'use strict';

// MODULES //

var isObjectLike = require( '@stdlib/utils/is-object-like' );
var isFunction = require( '@stdlib/utils/is-function' );


// IS BUFFER //

/**
* FUNCTION: isBuffer( value )
*	Tests if a value is a Buffer instance.
*
* @param {*} value - value to validate
* @returns {Boolean} boolean indicating if a value is a Buffer instance
*/
function isBuffer( value ) {
	return (
		isObjectLike( value ) &&
		(
			value._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)
			(
				value.constructor &&
				isFunction( value.constructor.isBuffer ) &&
				value.constructor.isBuffer( value )
			)
		)
	);
} // end FUNCTION isBuffer()


// EXPORTS //

module.exports = isBuffer;
