node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


is-audio-buffer Build Status Greenkeeper badge stable

Check whether an object is instance of AudioBuffer.


npm install is-audio-buffer

var isAudioBuffer = require('is-audio-buffer');
var ctx = require('audio-context');
var AudioBuffer = require('audio-buffer');
isAudioBuffer(ctx.createBuffer(2, 100, 44100)); //true
isAudioBuffer(new AudioBuffer([1, 0, 1, 0])); //true
isAudioBuffer(new Float32Array([1, 2, 3])); //false
isAudioBuffer(); //false

Because there is too many implementations of AudioBuffer (1, 2, 3, 4) to rely on a instanceof AudioBuffer.