Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5c88f17

Browse files
committed
Publish the dist folder
1 parent 2796aef commit 5c88f17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6450
-2
lines changed

‎.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
node_modules/
2-
dist/
3-
dist.*/
2+
#dist/
3+
#dist.*/
44
build/
55
.nyc_output/
66
coverage/

‎dist.es5+esm/CachedKeyDecoder.mjs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { utf8DecodeJs } from "./utils/utf8.mjs";
2+
var DEFAULT_MAX_KEY_LENGTH = 16;
3+
var DEFAULT_MAX_LENGTH_PER_KEY = 16;
4+
var CachedKeyDecoder = /** @class */ (function () {
5+
function CachedKeyDecoder(maxKeyLength, maxLengthPerKey) {
6+
if (maxKeyLength === void 0) { maxKeyLength = DEFAULT_MAX_KEY_LENGTH; }
7+
if (maxLengthPerKey === void 0) { maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY; }
8+
this.maxKeyLength = maxKeyLength;
9+
this.maxLengthPerKey = maxLengthPerKey;
10+
this.hit = 0;
11+
this.miss = 0;
12+
// avoid `new Array(N)`, which makes a sparse array,
13+
// because a sparse array is typically slower than a non-sparse array.
14+
this.caches = [];
15+
for (var i = 0; i < this.maxKeyLength; i++) {
16+
this.caches.push([]);
17+
}
18+
}
19+
CachedKeyDecoder.prototype.canBeCached = function (byteLength) {
20+
return byteLength > 0 && byteLength <= this.maxKeyLength;
21+
};
22+
CachedKeyDecoder.prototype.find = function (bytes, inputOffset, byteLength) {
23+
var records = this.caches[byteLength - 1];
24+
FIND_CHUNK: for (var _i = 0, records_1 = records; _i < records_1.length; _i++) {
25+
var record = records_1[_i];
26+
var recordBytes = record.bytes;
27+
for (var j = 0; j < byteLength; j++) {
28+
if (recordBytes[j] !== bytes[inputOffset + j]) {
29+
continue FIND_CHUNK;
30+
}
31+
}
32+
return record.str;
33+
}
34+
return null;
35+
};
36+
CachedKeyDecoder.prototype.store = function (bytes, value) {
37+
var records = this.caches[bytes.length - 1];
38+
var record = { bytes: bytes, str: value };
39+
if (records.length >= this.maxLengthPerKey) {
40+
// `records` are full!
41+
// Set `record` to an arbitrary position.
42+
records[(Math.random() * records.length) | 0] = record;
43+
}
44+
else {
45+
records.push(record);
46+
}
47+
};
48+
CachedKeyDecoder.prototype.decode = function (bytes, inputOffset, byteLength) {
49+
var cachedValue = this.find(bytes, inputOffset, byteLength);
50+
if (cachedValue != null) {
51+
this.hit++;
52+
return cachedValue;
53+
}
54+
this.miss++;
55+
var str = utf8DecodeJs(bytes, inputOffset, byteLength);
56+
// Ensure to copy a slice of bytes because the byte may be NodeJS Buffer and Buffer#slice() returns a reference to its internal ArrayBuffer.
57+
var slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);
58+
this.store(slicedCopyOfBytes, str);
59+
return str;
60+
};
61+
return CachedKeyDecoder;
62+
}());
63+
export { CachedKeyDecoder };
64+
//# sourceMappingURL=CachedKeyDecoder.mjs.map

‎dist.es5+esm/CachedKeyDecoder.mjs.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist.es5+esm/DecodeError.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var __extends = (this && this.__extends) || (function () {
2+
var extendStatics = function (d, b) {
3+
extendStatics = Object.setPrototypeOf ||
4+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6+
return extendStatics(d, b);
7+
};
8+
return function (d, b) {
9+
if (typeof b !== "function" && b !== null)
10+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11+
extendStatics(d, b);
12+
function __() { this.constructor = d; }
13+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14+
};
15+
})();
16+
var DecodeError = /** @class */ (function (_super) {
17+
__extends(DecodeError, _super);
18+
function DecodeError(message) {
19+
var _this = _super.call(this, message) || this;
20+
// fix the prototype chain in a cross-platform way
21+
var proto = Object.create(DecodeError.prototype);
22+
Object.setPrototypeOf(_this, proto);
23+
Object.defineProperty(_this, "name", {
24+
configurable: true,
25+
enumerable: false,
26+
value: DecodeError.name,
27+
});
28+
return _this;
29+
}
30+
return DecodeError;
31+
}(Error));
32+
export { DecodeError };
33+
//# sourceMappingURL=DecodeError.mjs.map

‎dist.es5+esm/DecodeError.mjs.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /