@percy/config 1.5.1 → 1.6.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/dist/utils/normalize.js +5 -5
- package/package.json +3 -3
package/dist/utils/normalize.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import merge from './merge.js';
|
|
2
2
|
import { getSchema } from '../validate.js'; // Edge case camelizations
|
|
3
3
|
|
|
4
|
-
const CAMELCASE_MAP = new Map([['css', 'CSS'], ['javascript', 'JavaScript']]); //
|
|
4
|
+
const CAMELCASE_MAP = new Map([['css', 'CSS'], ['javascript', 'JavaScript']]); // Regular expression that matches words from boundaries or consecutive casing
|
|
5
|
+
|
|
6
|
+
const WORD_REG = /[a-z]{2,}|[A-Z]{2,}|[0-9]{2,}|[^-_\s]+?(?=[A-Z0-9-_\s]|$)/g; // Converts kebab-cased and snake_cased strings to camelCase.
|
|
5
7
|
|
|
6
|
-
const KEBAB_SNAKE_REG = /[-_]([^-_]+)/g;
|
|
7
8
|
export function camelcase(str) {
|
|
8
9
|
if (typeof str !== 'string') return str;
|
|
9
|
-
return str.
|
|
10
|
+
return str.match(WORD_REG).reduce((s, w, i) => s + (i ? CAMELCASE_MAP.get(w.toLowerCase()) || w[0].toUpperCase() + w.slice(1).toLowerCase() : w.toLowerCase()), '');
|
|
10
11
|
} // Coverts camelCased and snake_cased strings to kebab-case.
|
|
11
12
|
|
|
12
|
-
const CAMEL_SNAKE_REG = /([a-z])([A-Z]+)|_([^_]+)/g;
|
|
13
13
|
export function kebabcase(str) {
|
|
14
14
|
if (typeof str !== 'string') return str;
|
|
15
|
-
return Array.from(CAMELCASE_MAP).reduce((str, [word, camel]) => str.replace(camel, `-${word}`), str).
|
|
15
|
+
return Array.from(CAMELCASE_MAP).reduce((str, [word, camel]) => str.replace(camel, `-${word}`), str).match(WORD_REG).join('-').toLowerCase();
|
|
16
16
|
} // Removes undefined empty values and renames kebab-case properties to camelCase. Optionally
|
|
17
17
|
// allows deep merging with options.overrides, converting keys to kebab-case with options.kebab,
|
|
18
18
|
// and normalizing against a schema with options.schema.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test:types": "tsd"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@percy/logger": "1.
|
|
37
|
+
"@percy/logger": "1.6.0",
|
|
38
38
|
"ajv": "^8.6.2",
|
|
39
39
|
"cosmiconfig": "^7.0.0",
|
|
40
40
|
"yaml": "^2.0.0"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"json-schema-typed": "^7.0.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "dd03aec4a68a26425cda3afd10fa142011198b5f"
|
|
46
46
|
}
|