properties-file 2.1.9 → 2.1.11

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
@@ -23,7 +23,7 @@ npm install properties-file
23
23
  - A modern TypeScript library that reproduces exactly the [Properties Java implementation](/assets/java-implementation.md).
24
24
  - Flexible APIs:
25
25
  - `propertiesToJson` allows quick conversion from `.properties` files to JSON.
26
- - `getProperties` returns a `Properties` object that allows insights into parsing issues such as key collisions.
26
+ - `getProperties` returns a `Properties` object that provides insights into parsing issues such as key collisions.
27
27
  - `propertiesToJson` & `getProperties` also have a browser-compatible version when passing directly the content of a file using the APIs under `properties-file/content`.
28
28
  - Out of the box Webpack loader to `import` `.properties` files directly in your application.
29
29
  - 100% test coverage based on the output from a Java implementation.
@@ -7,7 +7,7 @@ import { Properties } from '../properties';
7
7
  *
8
8
  * @returns A `Properties` object representing the content of a `.properties` file.
9
9
  */
10
- export declare function getProperties(content: string): Properties;
10
+ export declare const getProperties: (content: string) => Properties;
11
11
  /**
12
12
  * Converts the content of a `.properties` file to JSON.
13
13
  *
@@ -15,4 +15,4 @@ export declare function getProperties(content: string): Properties;
15
15
  *
16
16
  * @returns A (JSON) key/value object representing the content of a `.properties` file.
17
17
  */
18
- export declare function propertiesToJson(content: string): KeyValueObject;
18
+ export declare const propertiesToJson: (content: string) => KeyValueObject;
@@ -11,7 +11,7 @@ var property_line_1 = require("../property-line");
11
11
  *
12
12
  * @returns A `Properties` object representing the content of a `.properties` file.
13
13
  */
14
- function getProperties(content) {
14
+ var getProperties = function (content) {
15
15
  // Remove BOM character if present and create an array from lines.
16
16
  var lines = (content.codePointAt(0) === 0xfeff ? content.slice(1) : content).split(/\r?\n/);
17
17
  /** Line number while parsing properties file content. */
@@ -46,7 +46,7 @@ function getProperties(content) {
46
46
  property = properties.add(property);
47
47
  }
48
48
  return properties;
49
- }
49
+ };
50
50
  exports.getProperties = getProperties;
51
51
  /**
52
52
  * Converts the content of a `.properties` file to JSON.
@@ -55,7 +55,5 @@ exports.getProperties = getProperties;
55
55
  *
56
56
  * @returns A (JSON) key/value object representing the content of a `.properties` file.
57
57
  */
58
- function propertiesToJson(content) {
59
- return getProperties(content).toJson();
60
- }
58
+ var propertiesToJson = function (content) { return (0, exports.getProperties)(content).toJson(); };
61
59
  exports.propertiesToJson = propertiesToJson;
@@ -9,7 +9,7 @@ export { KeyValueObject } from '../';
9
9
  *
10
10
  * @returns A `Properties` object representing the content of a `.properties` file.
11
11
  */
12
- export declare function getProperties(filePath: string, encoding?: BufferEncoding): Properties;
12
+ export declare const getProperties: (filePath: string, encoding?: BufferEncoding) => Properties;
13
13
  /**
14
14
  * Converts the content of a `.properties` file to JSON.
15
15
  *
@@ -18,4 +18,4 @@ export declare function getProperties(filePath: string, encoding?: BufferEncodin
18
18
  *
19
19
  * @returns A (JSON) key/value object representing the content of a `.properties` file.
20
20
  */
21
- export declare function propertiesToJson(filePath: string, encoding?: BufferEncoding): KeyValueObject;
21
+ export declare const propertiesToJson: (filePath: string, encoding?: BufferEncoding) => KeyValueObject;
package/lib/file/index.js CHANGED
@@ -11,12 +11,12 @@ var content_1 = require("../content/");
11
11
  *
12
12
  * @returns A `Properties` object representing the content of a `.properties` file.
13
13
  */
14
- function getProperties(filePath, encoding) {
14
+ var getProperties = function (filePath, encoding) {
15
15
  if (!(0, node_fs_1.existsSync)(filePath)) {
16
16
  throw new Error("file not found at ".concat(filePath));
17
17
  }
18
18
  return (0, content_1.getProperties)((0, node_fs_1.readFileSync)(filePath, encoding !== null && encoding !== void 0 ? encoding : 'utf8'));
19
- }
19
+ };
20
20
  exports.getProperties = getProperties;
21
21
  /**
22
22
  * Converts the content of a `.properties` file to JSON.
@@ -26,7 +26,7 @@ exports.getProperties = getProperties;
26
26
  *
27
27
  * @returns A (JSON) key/value object representing the content of a `.properties` file.
28
28
  */
29
- function propertiesToJson(filePath, encoding) {
30
- return getProperties(filePath, encoding).toJson();
31
- }
29
+ var propertiesToJson = function (filePath, encoding) {
30
+ return (0, exports.getProperties)(filePath, encoding).toJson();
31
+ };
32
32
  exports.propertiesToJson = propertiesToJson;
@@ -7,4 +7,5 @@
7
7
  *
8
8
  * @returns A Webpack file loader string containing the content of a `.properties` file.
9
9
  */
10
- export default function (content: string): string;
10
+ declare const webpackLoader: (content: string) => string;
11
+ export default webpackLoader;
@@ -8,7 +8,7 @@ var content_1 = require("../content");
8
8
  *
9
9
  * @returns A Webpack file loader string containing the content of a `.properties` file.
10
10
  */
11
- function default_1(content) {
11
+ var webpackLoader = function (content) {
12
12
  return "module.exports = ".concat(JSON.stringify((0, content_1.propertiesToJson)(content)), ";");
13
- }
14
- exports.default = default_1;
13
+ };
14
+ exports.default = webpackLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "properties-file",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": ".properties file parser, JSON converter and Webpack loader.",
5
5
  "author": "Avansai (https://avansai.com)",
6
6
  "repository": {
@@ -53,19 +53,20 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@release-it/conventional-changelog": "^5.1.1",
56
- "@types/jest": "^29.1.2",
57
- "@typescript-eslint/eslint-plugin": "^5.39.0",
58
- "@typescript-eslint/parser": "^5.39.0",
56
+ "@types/jest": "^29.2.0",
57
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
58
+ "@typescript-eslint/parser": "^5.40.1",
59
59
  "dotenv-cli": "^6.0.0",
60
60
  "eslint": "^8.25.0",
61
61
  "eslint-config-prettier": "^8.5.0",
62
62
  "eslint-import-resolver-node": "^0.3.6",
63
- "eslint-import-resolver-typescript": "^3.5.1",
63
+ "eslint-import-resolver-typescript": "^3.5.2",
64
64
  "eslint-plugin-import": "^2.26.0",
65
- "eslint-plugin-jest": "^27.1.1",
65
+ "eslint-plugin-jest": "^27.1.3",
66
+ "eslint-plugin-prefer-arrow-functions": "^3.1.4",
66
67
  "eslint-plugin-prettier": "^4.2.1",
67
68
  "eslint-plugin-unicorn": "^44.0.2",
68
- "jest": "^29.1.2",
69
+ "jest": "^29.2.1",
69
70
  "prettier": "^2.7.1",
70
71
  "prettier-plugin-organize-imports": "^3.1.1",
71
72
  "prettier-plugin-sh": "^0.12.8",