editorconfig 4.0.0 → 4.0.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/lib/index.js CHANGED
@@ -192,13 +192,13 @@ function normalizeProps(options) {
192
192
  if (Object.prototype.hasOwnProperty.call(options, key)) {
193
193
  const value = options[key];
194
194
  const key2 = key.toLowerCase();
195
- let value2 = value;
196
- if (knownProps.has(key2)) {
197
- // All of the values for the known props are lowercase.
198
- value2 = String(value).toLowerCase();
199
- }
195
+ // All of the values for the known props are lowercase.
196
+ const str = knownProps.has(key2) ?
197
+ String(value).toLowerCase() :
198
+ String(value);
199
+ let value2 = str;
200
200
  try {
201
- value2 = JSON.parse(String(value));
201
+ value2 = JSON.parse(str);
202
202
  }
203
203
  catch (_e) {
204
204
  // Ignored
@@ -207,7 +207,7 @@ function normalizeProps(options) {
207
207
  //
208
208
  // null and undefined are values specific to JSON (no special meaning
209
209
  // in editorconfig) & should just be returned as regular strings.
210
- value2 = String(value);
210
+ value2 = str;
211
211
  }
212
212
  props[key2] = value2;
213
213
  }
package/lib/index.test.js CHANGED
@@ -298,6 +298,23 @@ indent_size = 3`));
298
298
  (0, chai_1.expect)(matcher(path.join(__dirname, 'package.json'))).to.include({ indent_size: 4 });
299
299
  (0, chai_1.expect)(matcher(path.join(__dirname, 'foo.json'))).to.include({ indent_size: 3 });
300
300
  });
301
+ it('parses known boolean values in any case', () => {
302
+ const matcher = editorconfig.matcher({
303
+ root: __dirname,
304
+ }, node_buffer_1.Buffer.from(`\
305
+ [*]
306
+ insert_final_newline = TRUE
307
+ trim_trailing_whitespace = False
308
+ indent_style = SPACE
309
+ charset = NULL
310
+ `));
311
+ (0, chai_1.expect)(matcher(path.join(__dirname, 'index.js'))).to.eql(Object.assign(Object.create(null), {
312
+ insert_final_newline: true,
313
+ trim_trailing_whitespace: false,
314
+ indent_style: 'space',
315
+ charset: 'null',
316
+ }));
317
+ });
301
318
  });
302
319
  describe('unset', () => {
303
320
  it('pair with the value `unset`', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editorconfig",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "EditorConfig File Locator and Interpreter for Node.js",
5
5
  "keywords": [
6
6
  "editorconfig",
@@ -21,7 +21,8 @@
21
21
  "Gareth Jones (https://github.com/G-Rath)",
22
22
  "Lorie (https://github.com/Lorie-Capella)",
23
23
  "simpleqt (https://github.com/simpleqt)",
24
- "Eli (https://github.com/lishaduck)"
24
+ "Eli (https://github.com/lishaduck)",
25
+ "bardrop (https://github.com/bardrop)"
25
26
  ],
26
27
  "directories": {
27
28
  "bin": "./bin",
@@ -36,11 +37,11 @@
36
37
  "license": "MIT",
37
38
  "dependencies": {
38
39
  "@one-ini/wasm": "0.2.3",
39
- "commander": "^15.0.0",
40
- "minimatch": "~11.0.4",
40
+ "commander": "^15.1.0",
41
+ "minimatch": "~11.0.5",
41
42
  "semver": "^7.8.6"
42
43
  },
43
- "packageManager": "pnpm@12.17.0",
44
+ "packageManager": "pnpm@12.18.0",
44
45
  "engines": {
45
46
  "node": ">=22"
46
47
  }