proskomma-core 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +41 -9
- package/dist/index.mjs +41 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15992,7 +15992,7 @@ var bitset = { exports: {} };
|
|
|
15992
15992
|
var bitsetExports = bitset.exports;
|
|
15993
15993
|
const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
|
|
15994
15994
|
const name = "proskomma-core";
|
|
15995
|
-
const version = "0.11.
|
|
15995
|
+
const version = "0.11.3";
|
|
15996
15996
|
const description$h = "A Scripture Runtime Engine";
|
|
15997
15997
|
const files = [
|
|
15998
15998
|
"dist"
|
|
@@ -16084,7 +16084,7 @@ const packageJson = {
|
|
|
16084
16084
|
dependencies: dependencies$1,
|
|
16085
16085
|
devDependencies
|
|
16086
16086
|
};
|
|
16087
|
-
const stringToUtf8ByteArray = function(str) {
|
|
16087
|
+
const stringToUtf8ByteArray$1 = function(str) {
|
|
16088
16088
|
var out = [], p = 0;
|
|
16089
16089
|
for (var i = 0; i < str.length; i++) {
|
|
16090
16090
|
var c = str.charCodeAt(i);
|
|
@@ -16133,7 +16133,7 @@ const utf8ByteArrayToString = function(bytes) {
|
|
|
16133
16133
|
};
|
|
16134
16134
|
var utf8StringBytes = {
|
|
16135
16135
|
utf8ByteArrayToString,
|
|
16136
|
-
stringToUtf8ByteArray
|
|
16136
|
+
stringToUtf8ByteArray: stringToUtf8ByteArray$1
|
|
16137
16137
|
};
|
|
16138
16138
|
var base64Js = {};
|
|
16139
16139
|
base64Js.byteLength = byteLength;
|
|
@@ -18917,19 +18917,36 @@ const recordPreEnum = (docSet, category, value) => {
|
|
|
18917
18917
|
docSet.preEnums[category].get(value).frequency++;
|
|
18918
18918
|
}
|
|
18919
18919
|
};
|
|
18920
|
+
const stringToUtf8ByteArray = (s) => {
|
|
18921
|
+
const encoder = new TextEncoder();
|
|
18922
|
+
return Array.from(encoder.encode(s));
|
|
18923
|
+
};
|
|
18920
18924
|
const buildEnum = (docSet, category, preEnumOb) => {
|
|
18921
18925
|
const sortedPreEnums = new Map([...preEnumOb.entries()]);
|
|
18922
18926
|
for (const enumText of sortedPreEnums.keys()) {
|
|
18923
|
-
|
|
18927
|
+
let truncatedText = enumText;
|
|
18928
|
+
const utf8Bytes = stringToUtf8ByteArray(enumText);
|
|
18929
|
+
if (utf8Bytes.length > 255) {
|
|
18924
18930
|
console.log(
|
|
18925
18931
|
"enum text for",
|
|
18926
18932
|
category,
|
|
18927
|
-
"has length",
|
|
18928
|
-
|
|
18929
|
-
"in buildEnum - truncating"
|
|
18933
|
+
"has byte length",
|
|
18934
|
+
utf8Bytes.length,
|
|
18935
|
+
"in buildEnum - truncating to 255 bytes"
|
|
18930
18936
|
);
|
|
18937
|
+
let byteCount = 0;
|
|
18938
|
+
let charCount = 0;
|
|
18939
|
+
for (const char of enumText) {
|
|
18940
|
+
const charBytes = stringToUtf8ByteArray(char).length;
|
|
18941
|
+
if (byteCount + charBytes > 255) {
|
|
18942
|
+
break;
|
|
18943
|
+
}
|
|
18944
|
+
byteCount += charBytes;
|
|
18945
|
+
charCount++;
|
|
18946
|
+
}
|
|
18947
|
+
truncatedText = enumText.substring(0, charCount);
|
|
18931
18948
|
}
|
|
18932
|
-
docSet.enums[category].pushCountedString(
|
|
18949
|
+
docSet.enums[category].pushCountedString(truncatedText);
|
|
18933
18950
|
}
|
|
18934
18951
|
docSet.enums[category].trim();
|
|
18935
18952
|
};
|
|
@@ -18949,7 +18966,22 @@ const enumForCategoryValue = (docSet, category, value, addUnknown) => {
|
|
|
18949
18966
|
enum: docSet.preEnums[category].size,
|
|
18950
18967
|
frequency: 1
|
|
18951
18968
|
});
|
|
18952
|
-
|
|
18969
|
+
let truncatedValue = value;
|
|
18970
|
+
const utf8Bytes = stringToUtf8ByteArray(value);
|
|
18971
|
+
if (utf8Bytes.length > 255) {
|
|
18972
|
+
let byteCount = 0;
|
|
18973
|
+
let charCount = 0;
|
|
18974
|
+
for (const char of value) {
|
|
18975
|
+
const charBytes = stringToUtf8ByteArray(char).length;
|
|
18976
|
+
if (byteCount + charBytes > 255) {
|
|
18977
|
+
break;
|
|
18978
|
+
}
|
|
18979
|
+
byteCount += charBytes;
|
|
18980
|
+
charCount++;
|
|
18981
|
+
}
|
|
18982
|
+
truncatedValue = value.substring(0, charCount);
|
|
18983
|
+
}
|
|
18984
|
+
docSet.enums[category].pushCountedString(truncatedValue);
|
|
18953
18985
|
docSet.buildEnumIndex(category);
|
|
18954
18986
|
return docSet.preEnums[category].get(value).enum;
|
|
18955
18987
|
} else {
|
package/dist/index.mjs
CHANGED
|
@@ -15990,7 +15990,7 @@ var bitset = { exports: {} };
|
|
|
15990
15990
|
var bitsetExports = bitset.exports;
|
|
15991
15991
|
const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
|
|
15992
15992
|
const name = "proskomma-core";
|
|
15993
|
-
const version = "0.11.
|
|
15993
|
+
const version = "0.11.3";
|
|
15994
15994
|
const description$h = "A Scripture Runtime Engine";
|
|
15995
15995
|
const files = [
|
|
15996
15996
|
"dist"
|
|
@@ -16082,7 +16082,7 @@ const packageJson = {
|
|
|
16082
16082
|
dependencies: dependencies$1,
|
|
16083
16083
|
devDependencies
|
|
16084
16084
|
};
|
|
16085
|
-
const stringToUtf8ByteArray = function(str) {
|
|
16085
|
+
const stringToUtf8ByteArray$1 = function(str) {
|
|
16086
16086
|
var out = [], p = 0;
|
|
16087
16087
|
for (var i = 0; i < str.length; i++) {
|
|
16088
16088
|
var c = str.charCodeAt(i);
|
|
@@ -16131,7 +16131,7 @@ const utf8ByteArrayToString = function(bytes) {
|
|
|
16131
16131
|
};
|
|
16132
16132
|
var utf8StringBytes = {
|
|
16133
16133
|
utf8ByteArrayToString,
|
|
16134
|
-
stringToUtf8ByteArray
|
|
16134
|
+
stringToUtf8ByteArray: stringToUtf8ByteArray$1
|
|
16135
16135
|
};
|
|
16136
16136
|
var base64Js = {};
|
|
16137
16137
|
base64Js.byteLength = byteLength;
|
|
@@ -18915,19 +18915,36 @@ const recordPreEnum = (docSet, category, value) => {
|
|
|
18915
18915
|
docSet.preEnums[category].get(value).frequency++;
|
|
18916
18916
|
}
|
|
18917
18917
|
};
|
|
18918
|
+
const stringToUtf8ByteArray = (s) => {
|
|
18919
|
+
const encoder = new TextEncoder();
|
|
18920
|
+
return Array.from(encoder.encode(s));
|
|
18921
|
+
};
|
|
18918
18922
|
const buildEnum = (docSet, category, preEnumOb) => {
|
|
18919
18923
|
const sortedPreEnums = new Map([...preEnumOb.entries()]);
|
|
18920
18924
|
for (const enumText of sortedPreEnums.keys()) {
|
|
18921
|
-
|
|
18925
|
+
let truncatedText = enumText;
|
|
18926
|
+
const utf8Bytes = stringToUtf8ByteArray(enumText);
|
|
18927
|
+
if (utf8Bytes.length > 255) {
|
|
18922
18928
|
console.log(
|
|
18923
18929
|
"enum text for",
|
|
18924
18930
|
category,
|
|
18925
|
-
"has length",
|
|
18926
|
-
|
|
18927
|
-
"in buildEnum - truncating"
|
|
18931
|
+
"has byte length",
|
|
18932
|
+
utf8Bytes.length,
|
|
18933
|
+
"in buildEnum - truncating to 255 bytes"
|
|
18928
18934
|
);
|
|
18935
|
+
let byteCount = 0;
|
|
18936
|
+
let charCount = 0;
|
|
18937
|
+
for (const char of enumText) {
|
|
18938
|
+
const charBytes = stringToUtf8ByteArray(char).length;
|
|
18939
|
+
if (byteCount + charBytes > 255) {
|
|
18940
|
+
break;
|
|
18941
|
+
}
|
|
18942
|
+
byteCount += charBytes;
|
|
18943
|
+
charCount++;
|
|
18944
|
+
}
|
|
18945
|
+
truncatedText = enumText.substring(0, charCount);
|
|
18929
18946
|
}
|
|
18930
|
-
docSet.enums[category].pushCountedString(
|
|
18947
|
+
docSet.enums[category].pushCountedString(truncatedText);
|
|
18931
18948
|
}
|
|
18932
18949
|
docSet.enums[category].trim();
|
|
18933
18950
|
};
|
|
@@ -18947,7 +18964,22 @@ const enumForCategoryValue = (docSet, category, value, addUnknown) => {
|
|
|
18947
18964
|
enum: docSet.preEnums[category].size,
|
|
18948
18965
|
frequency: 1
|
|
18949
18966
|
});
|
|
18950
|
-
|
|
18967
|
+
let truncatedValue = value;
|
|
18968
|
+
const utf8Bytes = stringToUtf8ByteArray(value);
|
|
18969
|
+
if (utf8Bytes.length > 255) {
|
|
18970
|
+
let byteCount = 0;
|
|
18971
|
+
let charCount = 0;
|
|
18972
|
+
for (const char of value) {
|
|
18973
|
+
const charBytes = stringToUtf8ByteArray(char).length;
|
|
18974
|
+
if (byteCount + charBytes > 255) {
|
|
18975
|
+
break;
|
|
18976
|
+
}
|
|
18977
|
+
byteCount += charBytes;
|
|
18978
|
+
charCount++;
|
|
18979
|
+
}
|
|
18980
|
+
truncatedValue = value.substring(0, charCount);
|
|
18981
|
+
}
|
|
18982
|
+
docSet.enums[category].pushCountedString(truncatedValue);
|
|
18951
18983
|
docSet.buildEnumIndex(category);
|
|
18952
18984
|
return docSet.preEnums[category].get(value).enum;
|
|
18953
18985
|
} else {
|