properties-file 3.2.24 → 3.3.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/lib/escape/index.js +2 -5
- package/lib/unescape/index.js +3 -2
- package/package.json +4 -4
package/lib/escape/index.js
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
* @param escapeUnicode - Escape unicode characters into ISO-8859-1 compatible encoding?
|
|
6
6
|
*
|
|
7
7
|
* @return The escaped key.
|
|
8
|
-
*/var escapeKey=exports.escapeKey=function(a){var b=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1];return escapeContent(a,!0,b)},escapeValue=exports.escapeValue=function(a){var b=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1];return escapeContent(a,!1,b)},escapeContent=function(a,b,c){
|
|
9
|
-
case"\\":{d+="\\\\";break}case"\f":{d+="\\f";break}case"\n":{d+="\\n";break}case"\r":{d+="\\r";break}case"\t":{d+="\\t";break}case"=":case":":case"#":case"!":{d+="\\".concat(e);break}default:{if(c){var g=e.codePointAt(0);// Can never be `undefined`.
|
|
10
|
-
if(32>g||126<g){d+="\\u".concat(g.toString(16).padStart(4,"0"));break}}// Non-escapable characters.
|
|
11
|
-
d+=e;break}}return d};/**
|
|
8
|
+
*/var escapeKey=exports.escapeKey=function(a){var b=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1];return escapeContent(a,!0,b)},escapeValue=exports.escapeValue=function(a){var b=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1];return escapeContent(a,!1,b)},escapeContent=function(a,b,c){return a.replace(new RegExp("[\\s!#:=\\\\".concat(c?"\\u0000-\\u001F\\u007F-\\uFFFF":"","]"),"g"),function(a){return" "===a?b?"\\ ":" ":"\\"===a?"\\\\":"\f"===a?"\\f":"\n"===a?"\\n":"\r"===a?"\\r":"\t"===a?"\\t":"="===a||":"===a||"#"===a||"!"===a?"\\".concat(a):"\\u".concat(a.codePointAt(0).toString(16).padStart(4,"0"))})};/**
|
|
12
9
|
* Escape property value.
|
|
13
10
|
*
|
|
14
11
|
* @param unescapedValue - Property value to be escaped.
|
|
@@ -22,5 +19,5 @@ d+=e;break}}return d};/**
|
|
|
22
19
|
* @param escapeSpace - Escape spaces?
|
|
23
20
|
* @param escapeUnicode - Escape unicode characters into ISO-8859-1 compatible encoding?
|
|
24
21
|
*
|
|
25
|
-
* @returns The
|
|
22
|
+
* @returns The escaped content.
|
|
26
23
|
*/
|
package/lib/unescape/index.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @throws {@link Error}
|
|
9
9
|
* This exception is thrown if malformed escaped unicode characters are present.
|
|
10
|
-
*/var unescapeContent=exports.unescapeContent=function(a){return
|
|
10
|
+
*/var unescapeContent=exports.unescapeContent=function(a){return(// By using a regular expression we avoid iterating through all characters and improve performance.
|
|
11
|
+
a.replace(/\\[^u]|\\u.{4}/g,function(a){var b=a.charAt(1);switch(b){case"f":// Formfeed.
|
|
11
12
|
return"\f";case"n":// Newline.
|
|
12
13
|
return"\n";case"r":// Carriage return.
|
|
13
14
|
return"\r";case"t":// Tab.
|
|
14
15
|
return"\t";case"u":{// Unicode character.
|
|
15
16
|
var c=a.slice(2,6);if(!/[\da-f]{4}/i.test(c))// Code point can only be within Unicode's Multilingual Plane (BMP).
|
|
16
|
-
throw new Error("malformed escaped unicode characters '\\u".concat(c,"'"));return String.fromCodePoint(Number.parseInt(c,16))}default:return b}})};
|
|
17
|
+
throw new Error("malformed escaped unicode characters '\\u".concat(c,"'"));return String.fromCodePoint(Number.parseInt(c,16))}default:return b}}))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "properties-file",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": ".properties file parser, editor, formatter and Webpack loader.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
".properties",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"@babel/preset-typescript": "7.23.0",
|
|
70
70
|
"@release-it/conventional-changelog": "7.0.2",
|
|
71
71
|
"@types/jest": "29.5.5",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "6.7.
|
|
73
|
-
"@typescript-eslint/parser": "6.7.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "6.7.5",
|
|
73
|
+
"@typescript-eslint/parser": "6.7.5",
|
|
74
74
|
"babel-preset-minify": "^0.5.2",
|
|
75
75
|
"check-node-version": "^4.2.1",
|
|
76
76
|
"dotenv-cli": "7.3.0",
|
|
77
|
-
"eslint": "8.
|
|
77
|
+
"eslint": "8.51.0",
|
|
78
78
|
"eslint-config-prettier": "9.0.0",
|
|
79
79
|
"eslint-import-resolver-node": "0.3.9",
|
|
80
80
|
"eslint-import-resolver-typescript": "3.6.1",
|