New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@phensley/cldr-utils

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phensley/cldr-utils - npm Package Compare versions

Comparing version 0.13.5 to 0.13.6

11

lib-es/checksum.d.ts
/**
* Compute FNV-1a checksum on the input string. This assumes the
* string has been converted to a UTF-8 Uint8Array, otherwise only the low
* byte of each character would be summed.
* FNV-1A incremental checksum.
*/
export declare const fnv1aChecksum: (s: Uint8Array) => number;
export declare class Checksum {
private v;
constructor();
update(s: string): this;
get(): number;
}
/**
* Compute FNV-1a checksum on the input string. This assumes the
* string has been converted to a UTF-8 Uint8Array, otherwise only the low
* byte of each character would be summed.
* FNV-1A incremental checksum.
*/
export var fnv1aChecksum = function (s) {
var r = 2166136261 /* BASIS */;
for (var i = 0; i < s.length; i++) {
r ^= s[i];
r += ((r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24));
var Checksum = /** @class */ (function () {
function Checksum() {
this.v = 0;
this.v = 2166136261 /* FNV1A_BASIS */;
}
return r >>> 0;
};
Checksum.prototype.update = function (s) {
var r = this.v;
for (var i = 0; i < s.length; i++) {
r ^= s.charCodeAt(i);
r += ((r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24));
}
this.v = r >>> 0;
return this;
};
Checksum.prototype.get = function () {
return this.v;
};
return Checksum;
}());
export { Checksum };
//# sourceMappingURL=checksum.js.map

@@ -19,5 +19,1 @@ /**

export declare const vuintEncode: (nums: number[] | Uint8Array, f?: ((x: number) => number) | undefined) => Uint8Array;
/**
* Convert a JavaScript UTF-16 string to UTF-8 bytes.
*/
export declare const utf8Encode: (s: string) => Uint8Array;

@@ -71,46 +71,2 @@ var floor = Math.floor, pow = Math.pow;

};
/**
* Convert a JavaScript UTF-16 string to UTF-8 bytes.
*/
export var utf8Encode = function (s) {
var r = new Uint8Array(s.length * 4);
var i = 0;
var j = 0;
var len = s.length;
while (i < len) {
var c = s.charCodeAt(i);
// Decode surrogate pair
if (c >= 0xd800 && c <= 0xd8ff) {
if (++i >= len) {
break;
}
c = ((c - 0xD800) * 0x400) + s.charCodeAt(i) - 0xDC00 + 0x10000;
}
// Encode
if (c < 0x80) {
// 0zzzzzzz
r[j++] = c;
}
else if (c < 0x800) {
// 110yyyyy 10zzzzzz
r[j++] = 192 /* B2LEAD */ | c >> 6;
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
else if (c < 0x10000) {
// 1110xxxx 10yyyyyy 10zzzzzz
r[j++] = 224 /* B3LEAD */ | c >> 12;
r[j++] = 128 /* MBLEAD */ | ((c >> 6) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
else if (c < 0x200000) {
// 11110www 10xxxxxx 10yyyyyy 10zzzzzz
r[j++] = 240 /* B4LEAD */ | (c >> 18);
r[j++] = 128 /* MBLEAD */ | ((c >> 12) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | ((c >> 6) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
i++;
}
return r.subarray(0, j);
};
//# sourceMappingURL=encoding.js.map
/**
* Compute FNV-1a checksum on the input string. This assumes the
* string has been converted to a UTF-8 Uint8Array, otherwise only the low
* byte of each character would be summed.
* FNV-1A incremental checksum.
*/
export declare const fnv1aChecksum: (s: Uint8Array) => number;
export declare class Checksum {
private v;
constructor();
update(s: string): this;
get(): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Compute FNV-1a checksum on the input string. This assumes the
* string has been converted to a UTF-8 Uint8Array, otherwise only the low
* byte of each character would be summed.
* FNV-1A incremental checksum.
*/
exports.fnv1aChecksum = function (s) {
var r = 2166136261 /* BASIS */;
for (var i = 0; i < s.length; i++) {
r ^= s[i];
r += ((r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24));
var Checksum = /** @class */ (function () {
function Checksum() {
this.v = 0;
this.v = 2166136261 /* FNV1A_BASIS */;
}
return r >>> 0;
};
Checksum.prototype.update = function (s) {
var r = this.v;
for (var i = 0; i < s.length; i++) {
r ^= s.charCodeAt(i);
r += ((r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24));
}
this.v = r >>> 0;
return this;
};
Checksum.prototype.get = function () {
return this.v;
};
return Checksum;
}());
exports.Checksum = Checksum;
//# sourceMappingURL=checksum.js.map

@@ -19,5 +19,1 @@ /**

export declare const vuintEncode: (nums: number[] | Uint8Array, f?: ((x: number) => number) | undefined) => Uint8Array;
/**
* Convert a JavaScript UTF-16 string to UTF-8 bytes.
*/
export declare const utf8Encode: (s: string) => Uint8Array;

@@ -73,46 +73,2 @@ "use strict";

};
/**
* Convert a JavaScript UTF-16 string to UTF-8 bytes.
*/
exports.utf8Encode = function (s) {
var r = new Uint8Array(s.length * 4);
var i = 0;
var j = 0;
var len = s.length;
while (i < len) {
var c = s.charCodeAt(i);
// Decode surrogate pair
if (c >= 0xd800 && c <= 0xd8ff) {
if (++i >= len) {
break;
}
c = ((c - 0xD800) * 0x400) + s.charCodeAt(i) - 0xDC00 + 0x10000;
}
// Encode
if (c < 0x80) {
// 0zzzzzzz
r[j++] = c;
}
else if (c < 0x800) {
// 110yyyyy 10zzzzzz
r[j++] = 192 /* B2LEAD */ | c >> 6;
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
else if (c < 0x10000) {
// 1110xxxx 10yyyyyy 10zzzzzz
r[j++] = 224 /* B3LEAD */ | c >> 12;
r[j++] = 128 /* MBLEAD */ | ((c >> 6) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
else if (c < 0x200000) {
// 11110www 10xxxxxx 10yyyyyy 10zzzzzz
r[j++] = 240 /* B4LEAD */ | (c >> 18);
r[j++] = 128 /* MBLEAD */ | ((c >> 12) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | ((c >> 6) & 63 /* MBMASK */);
r[j++] = 128 /* MBLEAD */ | (c & 63 /* MBMASK */);
}
i++;
}
return r.subarray(0, j);
};
//# sourceMappingURL=encoding.js.map
{
"name": "@phensley/cldr-utils",
"version": "0.13.5",
"version": "0.13.6",
"description": "Utilities for cldr-engine packages",

@@ -65,3 +65,3 @@ "main": "lib/index.js",

},
"gitHead": "7046510e8600b61db5c6cef93a8d55888d27d19b"
"gitHead": "687db479e4a9123c0f39c10af6c73a585b23689f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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