Skip to content

Commit

Permalink
Merge 4a98042 into 1f8ccd7
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Jan 26, 2016
2 parents 1f8ccd7 + 4a98042 commit d66e1af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/byte.js
Expand Up @@ -19,7 +19,6 @@ var Long = require('long');
var debug = require('debug')('byte');
var numbers = require('./number');
var utility = require('utility');
var is = require('is-type-of');

var DEFAULT_SIZE = 1024;
var BIG_ENDIAN = 1;
Expand Down Expand Up @@ -106,15 +105,15 @@ ByteBuffer.prototype.put = function (src, offset, length) {
};

ByteBuffer.prototype.get = function (index, length) {
if (is.buffer(index) || is.array(index)) { // get (byte[] dst, int offset, int length)
if (index instanceof Buffer || Array.isArray(index)) { // get (byte[] dst, int offset, int length)
var dst = index;
var offset = length || 0;
length = dst.length;

this.checkArraySize(dst.length, offset, length);
this.checkForUnderflow(length);

if (is.buffer(dst)) {
if (dst instanceof Buffer) {
this._bytes.copy(dst, offset, this._offset, (this._offset + length));
} else {
for (var i = offset; i < (offset + length); i++) {
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -18,7 +18,6 @@
},
"dependencies": {
"debug": "~2.2.0",
"is-type-of": "~0.3.1",
"long": "~2.2.5",
"utility": "~1.4.0"
},
Expand Down

0 comments on commit d66e1af

Please sign in to comment.