1 | import toCase from './to-case.js';
|
2 | export default ensureCase;
|
3 | function ensureCase(raw = '', target = 'lowercase') {
|
4 | // We delete any content together with quotes because he can contains proper names (example `refactor: `Eslint` configuration`).
|
5 | // We need trim string because content with quotes can be at the beginning or end of a line
|
6 | const input = String(raw)
|
7 | .replace(/`.*?`|".*?"|'.*?'/g, '')
|
8 | .trim();
|
9 | const transformed = toCase(input, target);
|
10 | if (transformed === '' || transformed.match(/^\d/)) {
|
11 | return true;
|
12 | }
|
13 | return transformed === input;
|
14 | }
|
15 | //# sourceMappingURL=case.js.map |
\ | No newline at end of file |