properties-file 3.2.1 → 3.2.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/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # properties-file
2
2
 
3
- [![License](https://img.shields.io/npm/l/make-coverage-badge.svg)](https://opensource.org/licenses/MIT)
4
- [![npm download](https://img.shields.io/npm/dw/properties-file.svg)](https://www.npmjs.com/package/properties-file)
3
+ [![License](https://img.shields.io/npm/l/make-coverage-badge.svg?color=brightgreen)](https://opensource.org/licenses/MIT)
4
+ [![npm download](https://img.shields.io/npm/dw/properties-file.svg?color=brightgreen)](https://www.npmjs.com/package/properties-file)
5
5
  ![Coverage](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg)
6
- ![Dependencies](https://img.shields.io/badge/dependencies-0-green)
6
+ ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
7
7
  [![Known Vulnerabilities](https://snyk.io/test/github/Avansai/properties-file/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Avansai/properties-file?targetFile=package.json)
8
8
 
9
9
  `.properties` file parser, editor, formatter and Webpack loader.
10
10
 
11
11
  ## Installation 💻
12
12
 
13
- > ⚠ In April 2023, we released version 3 of this package, which includes breaking changes. Please refer to the [migration guide](./V2-TO-V3-MIGRATION-GUIDE.md) before upgrading.
13
+ > ⚠ In April 2023, we released version 3 of this package, which includes breaking changes. Please refer to the [upgrade guide](./V2-TO-V3-UPGRADE-GUIDE.md) before upgrading.
14
14
 
15
15
  Add the package as a dependency:
16
16
 
@@ -24,8 +24,7 @@ if(a){var m,n;const b="after"===g?a.endingLineNumber:null!==(m=null===(n=a.previ
24
24
  * @param options - Additional options.
25
25
  *
26
26
  * @returns True if the comment was inserted, otherwise false.
27
- */insertComment(a,b){const c=null===b||void 0===b?void 0:b.referenceKey,d=(null===b||void 0===b?void 0:b.position)||"after",e="".concat((null===b||void 0===b?void 0:b.commentDelimiter)||DEFAULT_COMMENT_DELIMITER," "),f="".concat(e).concat(a)// eslint-disable-next-line unicorn/prefer-string-replace-all
28
- .replace(/\r?\n/g,"\n".concat(e)).split(/\n/);// Allow multiline comments.
27
+ */insertComment(a,b){const c=null===b||void 0===b?void 0:b.referenceKey,d=(null===b||void 0===b?void 0:b.position)||"after",e="".concat((null===b||void 0===b?void 0:b.commentDelimiter)||DEFAULT_COMMENT_DELIMITER," "),f="".concat(e).concat(a).replace(/\r?\n/g,"\n".concat(e)).split(/\n/);// Allow multiline comments.
29
28
  if(void 0===c)return this.lines.push(...f),this.parseLines(),!0;else{// Find the last occurrence of the reference key.
30
29
  const a=[...this.collection].reverse().find(a=>a.key===c);// Insert the new comment when a reference key defined only when found.
31
30
  if(a){var g,h;const b="after"===d?a.endingLineNumber:null!==(g=null===(h=a.previousProperty)||void 0===h?void 0:h.endingLineNumber)&&void 0!==g?g:0;return this.lines=[...this.lines.slice(0,b),...f,...this.lines.slice(b)],this.parseLines(),!0}return!1}}/**
@@ -43,16 +42,14 @@ const c=[...this.collection].reverse().find(b=>b.key===a);if(c){var d,e;const a=
43
42
  *
44
43
  * @returns The key with its original newlines characters restored.
45
44
  */getKeyWithNewlines(a){return 0===a.newlinePositions.length?a.key:// eslint-disable-next-line unicorn/no-array-reduce
46
- [...a.key].reduce((b,c,d)=>// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
47
- "".concat(b).concat(a.newlinePositions.includes(d)?"\n":"").concat(c),"")}/**
45
+ [...a.key].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d)?"\n":"").concat(c),"")}/**
48
46
  * Restore the original newline characters of a value.
49
47
  *
50
48
  * @param property - A property object.
51
49
  *
52
50
  * @returns The value with its original newlines characters restored.
53
51
  */getValueWithNewlines(a){return 0===a.newlinePositions.length||a.valuePosition===void 0?a.value:// eslint-disable-next-line unicorn/no-array-reduce
54
- [...a.value].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d+a.valuePosition)?"\n":""// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
55
- ).concat(c),"")}/**
52
+ [...a.value].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d+a.valuePosition)?"\n":"").concat(c),"")}/**
56
53
  * Update the last occurrence of a given key from the existing object.
57
54
  *
58
55
  * @param key - The name of the key to update.
package/lib/properties.js CHANGED
@@ -49,6 +49,4 @@ a.setKeyAndValue(),null!==(b=this.keyLineNumbers[a.key])&&void 0!==b&&b.length?(
49
49
  * @param startingLineNumbers - The starting line numbers where collisions are found.
50
50
  */constructor(a,b){this.key=a,this.startingLineNumbers=b}/**
51
51
  * Get the number of the line from which the value will be used.
52
- */getApplicableLineNumber(){// return this.startingLineNumbers.at(-1)
53
- // eslint-disable-next-line unicorn/prefer-at
54
- return this.startingLineNumbers.slice(-1)[0]}}exports.KeyCollisions=KeyCollisions;
52
+ */getApplicableLineNumber(){return this.startingLineNumbers.slice(-1)[0]}}exports.KeyCollisions=KeyCollisions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "properties-file",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
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.21.5",
70
70
  "@release-it/conventional-changelog": "5.1.1",
71
71
  "@types/jest": "29.5.1",
72
- "@typescript-eslint/eslint-plugin": "5.59.2",
73
- "@typescript-eslint/parser": "5.59.2",
72
+ "@typescript-eslint/eslint-plugin": "5.59.6",
73
+ "@typescript-eslint/parser": "5.59.6",
74
74
  "babel-preset-minify": "^0.5.2",
75
75
  "check-node-version": "^4.2.1",
76
76
  "dotenv-cli": "7.2.1",
77
- "eslint": "8.40.0",
77
+ "eslint": "8.41.0",
78
78
  "eslint-config-prettier": "8.8.0",
79
79
  "eslint-import-resolver-node": "0.3.7",
80
80
  "eslint-import-resolver-typescript": "3.5.5",