parse-tmx 2.22.0 → 2.23.0
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 +9 -9
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -301,14 +301,14 @@ const parseTileset = (node) => {
|
|
|
301
301
|
};
|
|
302
302
|
//#endregion
|
|
303
303
|
//#region src/util/parseXmlValue.ts
|
|
304
|
+
const NUMBER_REGEX = new RegExp(String.raw`^[+-]?\d+(\.\d+)?$`, "u");
|
|
304
305
|
const parseXmlValue = (value) => {
|
|
305
306
|
if (value === "true") return true;
|
|
306
|
-
if (value === "false") return false;
|
|
307
|
-
if (
|
|
307
|
+
else if (value === "false") return false;
|
|
308
|
+
else if (NUMBER_REGEX.test(value)) {
|
|
308
309
|
const parsedValue = parseFloat(value);
|
|
309
310
|
return isNaN(parsedValue) ? value : parsedValue;
|
|
310
|
-
}
|
|
311
|
-
return value;
|
|
311
|
+
} else return value;
|
|
312
312
|
};
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region ../xml2js/dist/index.js
|
|
@@ -15278,11 +15278,10 @@ var require_EventAlgorithm = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15278
15278
|
*/
|
|
15279
15279
|
const eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name);
|
|
15280
15280
|
if (eventTarget === null) return;
|
|
15281
|
-
if (value === null)
|
|
15281
|
+
if (value === null);
|
|
15282
15282
|
else {
|
|
15283
15283
|
const eventHandler = eventTarget._eventHandlerMap["onabort"];
|
|
15284
15284
|
if (eventHandler !== void 0) eventHandler.value = value;
|
|
15285
|
-
event_activateAnEventHandler(eventTarget, name);
|
|
15286
15285
|
}
|
|
15287
15286
|
}
|
|
15288
15287
|
/**
|
|
@@ -28493,6 +28492,7 @@ const DefaultParserOptions = {
|
|
|
28493
28492
|
trim: false,
|
|
28494
28493
|
xmlns: false
|
|
28495
28494
|
};
|
|
28495
|
+
new RegExp(String.raw`(?!xmlns)^.*:`, "u");
|
|
28496
28496
|
const normalize = (string) => string.toLowerCase();
|
|
28497
28497
|
const stripBOM = (str) => str.startsWith("") ? str.slice(1) : str;
|
|
28498
28498
|
function BufferList() {
|
|
@@ -31122,12 +31122,12 @@ var Parser = class {
|
|
|
31122
31122
|
const nextObject = this.stack.at(-1);
|
|
31123
31123
|
let emptyString = "";
|
|
31124
31124
|
const char = object[this.options.charkey];
|
|
31125
|
-
if (/^\s
|
|
31125
|
+
if (/^\s*$/u.exec(char) && !cdata) {
|
|
31126
31126
|
emptyString = char;
|
|
31127
31127
|
delete object[this.options.charkey];
|
|
31128
31128
|
} else {
|
|
31129
31129
|
if (this.options.trim) object[this.options.charkey] = char.trim();
|
|
31130
|
-
if (this.options.normalize) object[this.options.charkey] = char.replaceAll(/\s{2,}/
|
|
31130
|
+
if (this.options.normalize) object[this.options.charkey] = char.replaceAll(/\s{2,}/gu, " ").trim();
|
|
31131
31131
|
object[this.options.charkey] = this.options.valueProcessors ? processItem(this.options.valueProcessors, char, nodeName) : char;
|
|
31132
31132
|
if (Object.keys(object).length === 1 && this.options.charkey in object) object = object[this.options.charkey];
|
|
31133
31133
|
}
|
|
@@ -31177,7 +31177,7 @@ var Parser = class {
|
|
|
31177
31177
|
[BUILTIN_NAME_KEY]: TEXT_NODE_NAME,
|
|
31178
31178
|
[this.options.charkey]: text
|
|
31179
31179
|
};
|
|
31180
|
-
if (this.options.normalize) charChild[this.options.charkey] = takeOne(charChild, this.options.charkey).replaceAll(/\s{2,}/
|
|
31180
|
+
if (this.options.normalize) charChild[this.options.charkey] = takeOne(charChild, this.options.charkey).replaceAll(/\s{2,}/gu, " ").trim();
|
|
31181
31181
|
object[this.options.childkey].push(charChild);
|
|
31182
31182
|
}
|
|
31183
31183
|
return object;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "A parser for tmx.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"parser",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"typecheck": "tsgo"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@esposter/shared": "2.
|
|
41
|
-
"@esposter/xml2js": "2.
|
|
40
|
+
"@esposter/shared": "2.23.0",
|
|
41
|
+
"@esposter/xml2js": "2.23.0",
|
|
42
42
|
"data-urls": "^7.0.0",
|
|
43
43
|
"dayjs": "^1.11.20"
|
|
44
44
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/data-urls": "^3.0.5",
|
|
47
47
|
"@types/xml2js": "^0.4.14"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b5172e2824227a4b5e9524a4945f521a70ff5c9d"
|
|
50
50
|
}
|