Socket
Socket
Sign inDemoInstall

unicode-trie

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unicode-trie - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

12

builder.js

@@ -639,13 +639,13 @@ // Generated by CoffeeScript 1.7.1

UnicodeTrieBuilder.prototype.toBuffer = function() {
var b, buf, data, i, trie, _i, _len;
var b, buf, compressed, data, i, trie, _i, _len;
trie = this.freeze();
data = new Uint8Array(trie.data.buffer);
data = pako.deflateRaw(data);
data = pako.deflateRaw(data);
buf = new Buffer(data.length + 12);
compressed = pako.deflateRaw(data);
compressed = pako.deflateRaw(compressed);
buf = new Buffer(compressed.length + 12);
buf.writeUInt32BE(trie.highStart, 0);
buf.writeUInt32BE(trie.errorValue, 4);
buf.writeUInt32BE(data.length, 8);
for (i = _i = 0, _len = data.length; _i < _len; i = ++_i) {
b = data[i];
for (i = _i = 0, _len = compressed.length; _i < _len; i = ++_i) {
b = compressed[i];
buf[i + 12] = b;

@@ -652,0 +652,0 @@ }

// Generated by CoffeeScript 1.7.1
var UnicodeTrie, pako;
var UnicodeTrie, inflate;
pako = require('pako/lib/inflate');
inflate = require('tiny-inflate');

@@ -42,10 +42,19 @@ UnicodeTrie = (function() {

function UnicodeTrie(data) {
var length;
if (Buffer.isBuffer(data)) {
this.highStart = data.readUInt32BE(0);
this.errorValue = data.readUInt32BE(4);
length = data.readUInt32BE(8);
data = data.slice(12);
data = pako.inflateRaw(data);
data = pako.inflateRaw(data);
var isBuffer, uncompressedLength, view;
isBuffer = typeof data.readUInt32BE === 'function' && typeof data.slice === 'function';
if (isBuffer || data instanceof Uint8Array) {
if (isBuffer) {
this.highStart = data.readUInt32BE(0);
this.errorValue = data.readUInt32BE(4);
uncompressedLength = data.readUInt32BE(8);
data = data.slice(12);
} else {
view = new DataView(data.buffer);
this.highStart = view.getUint32(0);
this.errorValue = view.getUint32(4);
uncompressedLength = view.getUint32(8);
data = data.subarray(12);
}
data = inflate(data, new Uint8Array(uncompressedLength));
data = inflate(data, new Uint8Array(uncompressedLength));
this.data = new Uint32Array(data.buffer);

@@ -52,0 +61,0 @@ } else {

{
"name": "unicode-trie",
"version": "0.2.0",
"version": "0.3.0",
"description": "Unicode Trie data structure for fast character metadata lookup, ported from ICU",

@@ -26,4 +26,5 @@ "devDependencies": {

"dependencies": {
"pako": "^0.2.5"
"pako": "^0.2.5",
"tiny-inflate": "^1.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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