JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 456482
  • Score
    100M100P100Q198152F
  • License Apache-2.0

Test if a value is a Buffer object.

Package Exports

  • @stdlib/assert-is-buffer
  • @stdlib/assert-is-buffer/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/assert-is-buffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

isBuffer

NPM version Build Status Coverage Status

Test if a value is a Buffer object.

Installation

npm install @stdlib/assert-is-buffer

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

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright © 2016-2022. The Stdlib Authors.