Permalink
Browse files

Use Buffer.isBuffer, rather than instanceof.

  • Loading branch information...
1 parent be90ced commit 7c9327aa1d7fc237257f524e42ea77c2927f7386 @stephank committed Apr 12, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
View
@@ -66,7 +66,7 @@ function ArrayBuffer(subject, begin, end) {
}
// Buffer constructor
- else if (subject instanceof Buffer) {
+ else if (Buffer.isBuffer(subject)) {
this.nodeBuffer = subject;
this.byteLength = subject.length;
}
@@ -102,7 +102,7 @@ function ArrayBufferView() {
// if the constructor call was indeed of that kind, and sets attributes if so.
function makeViewFromBuffer(view, args, typeSize) {
var buffer = args[0];
- if (buffer instanceof Buffer) {
+ if (Buffer.isBuffer(buffer)) {
buffer = new ArrayBuffer(buffer);
}
else if (!(buffer instanceof ArrayBuffer)) {

0 comments on commit 7c9327a

Please sign in to comment.