Skip to content
 
 

Repository files navigation

@stackline/is-buffer

Determine if an object is a Buffer.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.2


Why this package?

@stackline/is-buffer is the Stackline-maintained distribution of is-buffer@2.0.5. It is an independent continuation of is-buffer; original authors and licenses remain credited below.

Compatibility

Item Value
Package @stackline/is-buffer@1.0.2
API target is-buffer@2.0.5
Supported Node.js >=4
License MIT
Main entry index.js
Runtime dependencies none

Installation

npm install @stackline/is-buffer

Preserve existing imports and plugin resolution with an npm alias:

npm install is-buffer@npm:@stackline/is-buffer

Usage and API reference

is-buffer travis npm downloads javascript style guide

Determine if an object is a Buffer (including the browserify Buffer)

Why not use Buffer.isBuffer?

This module lets you check if an object is a Buffer without using Buffer.isBuffer (which includes the whole buffer module in browserify).

It's future-proof and works in node too!

install

npm install @stackline/is-buffer

usage

var isBuffer = require('@stackline/is-buffer')

isBuffer(new Buffer(4)) // true
isBuffer(Buffer.alloc(4)) //true

isBuffer(undefined) // false
isBuffer(null) // false
isBuffer('') // false
isBuffer(true) // false
isBuffer(false) // false
isBuffer(0) // false
isBuffer(1) // false
isBuffer(1.0) // false
isBuffer('string') // false
isBuffer({}) // false
isBuffer(function foo () {}) // false

license

MIT. Copyright (C) Feross Aboukhadijeh.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

License

MIT. See the license and notice files in the repository.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.