UNPKG

892 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const to_case_1 = __importDefault(require("./to-case"));
7exports.default = ensureCase;
8function ensureCase(raw = '', target = 'lowercase') {
9 // We delete any content together with quotes because he can contains proper names (example `refactor: `Eslint` configuration`).
10 // We need trim string because content with quotes can be at the beginning or end of a line
11 const input = String(raw)
12 .replace(/`.*?`|".*?"|'.*?'/g, '')
13 .trim();
14 const transformed = (0, to_case_1.default)(input, target);
15 if (transformed === '' || transformed.match(/^\d/)) {
16 return true;
17 }
18 return transformed === input;
19}
20//# sourceMappingURL=case.js.map
\No newline at end of file