native-buffer-browserify
Advanced tools
Comparing version 2.0.12 to 2.0.13
53
index.js
@@ -77,3 +77,3 @@ var base64 = require('base64-js') | ||
} else { | ||
// Fallback: Return this instance of Buffer | ||
// Fallback: Return THIS instance of Buffer (created by `new`) | ||
buf = this | ||
@@ -127,3 +127,3 @@ buf.length = length | ||
Buffer.isBuffer = function (b) { | ||
return (b != null && b._isBuffer) || false | ||
return !!(b !== null && b !== undefined && b._isBuffer) | ||
} | ||
@@ -208,9 +208,11 @@ | ||
function _utf8Write (buf, string, offset, length) { | ||
var bytes, pos | ||
return Buffer._charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length) | ||
var charsWritten = Buffer._charsWritten = | ||
blitBuffer(utf8ToBytes(string), buf, offset, length) | ||
return charsWritten | ||
} | ||
function _asciiWrite (buf, string, offset, length) { | ||
var bytes, pos | ||
return Buffer._charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length) | ||
var charsWritten = Buffer._charsWritten = | ||
blitBuffer(asciiToBytes(string), buf, offset, length) | ||
return charsWritten | ||
} | ||
@@ -223,4 +225,5 @@ | ||
function _base64Write (buf, string, offset, length) { | ||
var bytes, pos | ||
return Buffer._charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length) | ||
var charsWritten = Buffer._charsWritten = | ||
blitBuffer(base64ToBytes(string), buf, offset, length) | ||
return charsWritten | ||
} | ||
@@ -421,12 +424,11 @@ | ||
Buffer.prototype.readUInt8 = function (offset, noAssert) { | ||
var buf = this | ||
if (!noAssert) { | ||
assert(offset !== undefined && offset !== null, 'missing offset') | ||
assert(offset < buf.length, 'Trying to read beyond buffer length') | ||
assert(offset < this.length, 'Trying to read beyond buffer length') | ||
} | ||
if (offset >= buf.length) | ||
if (offset >= this.length) | ||
return | ||
return buf[offset] | ||
return this[offset] | ||
} | ||
@@ -507,17 +509,16 @@ | ||
Buffer.prototype.readInt8 = function (offset, noAssert) { | ||
var buf = this | ||
if (!noAssert) { | ||
assert(offset !== undefined && offset !== null, | ||
'missing offset') | ||
assert(offset < buf.length, 'Trying to read beyond buffer length') | ||
assert(offset < this.length, 'Trying to read beyond buffer length') | ||
} | ||
if (offset >= buf.length) | ||
if (offset >= this.length) | ||
return | ||
var neg = buf[offset] & 0x80 | ||
var neg = this[offset] & 0x80 | ||
if (neg) | ||
return (0xff - buf[offset] + 1) * -1 | ||
return (0xff - this[offset] + 1) * -1 | ||
else | ||
return buf[offset] | ||
return this[offset] | ||
} | ||
@@ -614,13 +615,12 @@ | ||
Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { | ||
var buf = this | ||
if (!noAssert) { | ||
assert(value !== undefined && value !== null, 'missing value') | ||
assert(offset !== undefined && offset !== null, 'missing offset') | ||
assert(offset < buf.length, 'trying to write beyond buffer length') | ||
assert(offset < this.length, 'trying to write beyond buffer length') | ||
verifuint(value, 0xff) | ||
} | ||
if (offset >= buf.length) return | ||
if (offset >= this.length) return | ||
buf[offset] = value | ||
this[offset] = value | ||
} | ||
@@ -684,17 +684,16 @@ | ||
Buffer.prototype.writeInt8 = function (value, offset, noAssert) { | ||
var buf = this | ||
if (!noAssert) { | ||
assert(value !== undefined && value !== null, 'missing value') | ||
assert(offset !== undefined && offset !== null, 'missing offset') | ||
assert(offset < buf.length, 'Trying to write beyond buffer length') | ||
assert(offset < this.length, 'Trying to write beyond buffer length') | ||
verifsint(value, 0x7f, -0x80) | ||
} | ||
if (offset >= buf.length) | ||
if (offset >= this.length) | ||
return | ||
if (value >= 0) | ||
buf.writeUInt8(value, offset, noAssert) | ||
this.writeUInt8(value, offset, noAssert) | ||
else | ||
buf.writeUInt8(0xff + value + 1, offset, noAssert) | ||
this.writeUInt8(0xff + value + 1, offset, noAssert) | ||
} | ||
@@ -701,0 +700,0 @@ |
{ | ||
"name": "native-buffer-browserify", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"description": "buffer module compatibility for browserify (backed by ArrayBuffer so its fast!)", | ||
@@ -12,3 +12,2 @@ "main": "index.js", | ||
"benchmark": "*", | ||
"browserify": "*", | ||
"tape": "*" | ||
@@ -15,0 +14,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1213202
2
17785