node package manager

is-audio-buffer

is-audio-buffer Build Status stable

Check whether an object is instance of AudioBuffer.

Usage

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.