Socket
Socket
Sign inDemoInstall

@protobufjs/utf8

Package Overview
Dependencies
0
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

21

index.js

@@ -44,3 +44,4 @@ "use strict";

return "";
var string = [],
var parts = [],
chunk = [],
i = 0, // char offset

@@ -51,13 +52,19 @@ t; // temporary

if (t < 128)
string[i++] = t;
chunk[i++] = t;
else if (t > 191 && t < 224)
string[i++] = (t & 31) << 6 | buffer[start++] & 63;
chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
else if (t > 239 && t < 365) {
t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
string[i++] = 0xD800 + (t >> 10);
string[i++] = 0xDC00 + (t & 1023);
chunk[i++] = 0xD800 + (t >> 10);
chunk[i++] = 0xDC00 + (t & 1023);
} else
string[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
if (i > 8191) {
parts.push(String.fromCharCode.apply(String, chunk));
i = 0;
}
}
return String.fromCharCode.apply(String, string.slice(0, i));
if (i)
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
return parts.join("");
};

@@ -64,0 +71,0 @@

{
"name": "@protobufjs/utf8",
"description": "A minimal UTF8 implementation for number arrays.",
"version": "1.0.2",
"version": "1.0.3",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",

@@ -6,0 +6,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc