Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

avsc

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avsc - npm Package Compare versions

Comparing version 5.0.0-rc19 to 5.0.0

26

etc/browser/avsc-types.js

@@ -14,28 +14,2 @@ /* jshint browserify: true */

// Since there are no utf8 and binary functions on browserify's `Buffer`, we
// must patch in tap methods using the generic slice and write methods.
(function polyfillTap() {
var Tap = require('../../lib/utils').Tap;
Tap.prototype.readString = function () {
var len = this.readLong();
var pos = this.pos;
var buf = this.buf;
this.pos += len;
if (this.pos > buf.length) {
return;
}
return this.buf.slice(pos, pos + len).toString();
};
Tap.prototype.writeBinary = function (s, len) {
var pos = this.pos;
this.pos += len;
if (this.pos > this.buf.length) {
return;
}
this.buf.write(s, pos, len, 'binary');
};
})();
/** Basic parse method, only supporting JSON parsing. */

@@ -42,0 +16,0 @@ function parse(any, opts) {

82

lib/utils.js

@@ -550,12 +550,27 @@ /* jshint node: true */

Tap.prototype.readString = function () {
var len = this.readLong();
var pos = this.pos;
var buf = this.buf;
this.pos += len;
if (this.pos > buf.length) {
return;
}
return this.buf.utf8Slice(pos, pos + len);
};
/* istanbul ignore else */
if (typeof Buffer.prototype.utf8Slice == 'function') {
// Use this optimized function when available.
Tap.prototype.readString = function () {
var len = this.readLong();
var pos = this.pos;
var buf = this.buf;
this.pos += len;
if (this.pos > buf.length) {
return;
}
return this.buf.utf8Slice(pos, pos + len);
};
} else {
Tap.prototype.readString = function () {
var len = this.readLong();
var pos = this.pos;
var buf = this.buf;
this.pos += len;
if (this.pos > buf.length) {
return;
}
return this.buf.slice(pos, pos + len).toString();
};
}

@@ -602,20 +617,35 @@ Tap.prototype.skipString = function () {

// Helper used to speed up writing defaults.
Tap.prototype.writeBinary = function (str, len) {
var pos = this.pos;
this.pos += len;
if (this.pos > this.buf.length) {
return;
}
/* istanbul ignore else */
if (this.buf.latin1Write) {
// `binaryWrite` has been renamed to `latin1Write` in Node v6.4.0, see
// https://github.com/nodejs/node/pull/7111. Note that the `'binary'`
// encoding argument still works however.
/* istanbul ignore else */
if (typeof Buffer.prototype.latin1Write == 'function') {
// `binaryWrite` has been renamed to `latin1Write` in Node v6.4.0, see
// https://github.com/nodejs/node/pull/7111. Note that the `'binary'`
// encoding argument still works however.
Tap.prototype.writeBinary = function (str, len) {
var pos = this.pos;
this.pos += len;
if (this.pos > this.buf.length) {
return;
}
this.buf.latin1Write(str, pos, len);
} else {
};
} else if (typeof Buffer.prototype.binaryWrite == 'function') {
Tap.prototype.writeBinary = function (str, len) {
var pos = this.pos;
this.pos += len;
if (this.pos > this.buf.length) {
return;
}
this.buf.binaryWrite(str, pos, len);
}
};
};
} else {
// Slowest implementation.
Tap.prototype.writeBinary = function (s, len) {
var pos = this.pos;
this.pos += len;
if (this.pos > this.buf.length) {
return;
}
this.buf.write(s, pos, len, 'binary');
};
}

@@ -622,0 +652,0 @@ // Binary comparison methods.

{
"name": "avsc",
"version": "5.0.0-rc19",
"version": "5.0.0",
"description": "Avro for JavaScript",

@@ -53,3 +53,3 @@ "homepage": "https://github.com/mtth/avsc",

"benchmark": "^2.1.3",
"coveralls": "^2.11.15",
"coveralls": "^2.12.0",
"istanbul": "^0.4.5",

@@ -56,0 +56,0 @@ "mocha": "^3.1.2",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc