Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use Buffer.isBuffer, rather than instanceof.

  • Loading branch information...
commit 7c9327aa1d7fc237257f524e42ea77c2927f7386 1 parent be90ced
Stéphan Kochen authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
4 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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.