properties-file 3.1.0 → 3.1.1
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/README.md +5 -2
- package/lib/properties.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -168,13 +168,16 @@ properties.insert('newKey2', 'こんにちは', {
|
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
properties.delete('hello')
|
|
171
|
+
properties.update('world', {
|
|
172
|
+
newValue: 'new world',
|
|
173
|
+
})
|
|
171
174
|
console.log(properties.format())
|
|
172
175
|
|
|
173
176
|
/**
|
|
174
177
|
* Outputs:
|
|
175
178
|
*
|
|
176
179
|
* # This is a comment
|
|
177
|
-
* world = world
|
|
180
|
+
* world = new world
|
|
178
181
|
* ! Below are the new keys being edited
|
|
179
182
|
* newKey1 = This is my first new key
|
|
180
183
|
* newKey2 = \u3053\u3093\u306b\u3061\u306f
|
|
@@ -184,7 +187,7 @@ console.log(properties.format())
|
|
|
184
187
|
*/
|
|
185
188
|
```
|
|
186
189
|
|
|
187
|
-
|
|
190
|
+
For convenience, we also added an `upsert` method that allows updating a key if it exists or adding it at the end, when it doesn't. Make sure to check in your IDE for all available methods and options in our TSDoc.
|
|
188
191
|
|
|
189
192
|
### Webpack File Loader
|
|
190
193
|
|
package/lib/properties.js
CHANGED
|
@@ -64,7 +64,7 @@ var Properties = /** @class */ (function () {
|
|
|
64
64
|
this.collection = [];
|
|
65
65
|
/** Object associating keys with their starting line numbers. */
|
|
66
66
|
this.keyLineNumbers = {};
|
|
67
|
-
var stringContent =
|
|
67
|
+
var stringContent = typeof content === 'string' ? content : content.toString();
|
|
68
68
|
this.hasBom = stringContent.codePointAt(0) === exports.BOM_CODE_POINT;
|
|
69
69
|
this.eolCharacter = (_a = (0, exports.getFirstEolCharacter)(stringContent)) !== null && _a !== void 0 ? _a : exports.DEFAULT_END_OF_LINE_CHARACTER;
|
|
70
70
|
this.lines = (this.hasBom ? stringContent.slice(1) : stringContent).split(/\r?\n/);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "properties-file",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": ".properties file parser, editor, formatter and Webpack loader.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
".properties",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prettier": "2.8.8",
|
|
84
84
|
"prettier-plugin-organize-imports": "3.2.2",
|
|
85
85
|
"prettier-plugin-sh": "0.12.8",
|
|
86
|
-
"release-it": "15.10.
|
|
86
|
+
"release-it": "15.10.2",
|
|
87
87
|
"ts-jest": "29.1.0",
|
|
88
88
|
"ts-node": "10.9.1",
|
|
89
89
|
"typescript": "5.0.4"
|