fix price and modular
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "fast-xml-parser",
|
||||
"version": "5.3.3",
|
||||
"version": "5.3.4",
|
||||
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
|
||||
"main": "./lib/fxp.cjs",
|
||||
"type": "module",
|
||||
|
||||
+12
-2
@@ -41,8 +41,8 @@ export default class OrderedObjParser{
|
||||
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
|
||||
"reg" : { regex: /&(reg|#174);/g, val: "®" },
|
||||
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
|
||||
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 10)) },
|
||||
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 16)) },
|
||||
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => fromCodePoint(str, 10, "&#") },
|
||||
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => fromCodePoint(str, 16, "&#x") },
|
||||
};
|
||||
this.addExternalEntities = addExternalEntities;
|
||||
this.parseXml = parseXml;
|
||||
@@ -627,3 +627,13 @@ function parseValue(val, shouldParse, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fromCodePoint(str, base, prefix){
|
||||
const codePoint = Number.parseInt(str, base);
|
||||
|
||||
if (codePoint >= 0 && codePoint <= 0x10FFFF) {
|
||||
return String.fromCodePoint(codePoint);
|
||||
} else {
|
||||
return prefix +str + ";";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user