time-to-botec/squiggle/node_modules/@stdlib/assert/is-buffer
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

isBuffer

Test if a value is a Buffer object.

Usage

var isBuffer = require( '@stdlib/assert/is-buffer' );

isBuffer( value )

Tests if a value is a Buffer object.

var Buffer = require( '@stdlib/buffer/ctor' );

var value = new Buffer( [ 1, 2, 3, 4 ] );

var bool = isBuffer( value );
// returns true

Notes

Examples

var Int8Array = require( '@stdlib/array/int8' );
var Buffer = require( '@stdlib/buffer/ctor' );
var isBuffer = require( '@stdlib/assert/is-buffer' );

var bool = isBuffer( new Buffer( [ 1, 2, 3, 4 ] ) );
// returns true

bool = isBuffer( new Buffer( 'beep' ) );
// returns true

bool = isBuffer( [] );
// returns false

bool = isBuffer( {} );
// returns false

bool = isBuffer( new Int8Array() );
// returns false

bool = isBuffer( function foo() {} );
// returns false

bool = isBuffer( null );
// returns false

bool = isBuffer( void 0 );
// returns false

bool = isBuffer( 'beep' );
// returns false

bool = isBuffer( 5 );
// returns false