@commitlint/prompt
Version:
commitizen prompt using commitlint.config.js
19 lines • 589 B
JavaScript
import { toCase } from "@commitlint/ensure";
import { ruleIsActive, ruleIsNotApplicable } from "./utils.js";
/**
* Get forced case for rule
* @param rule to parse
* @return transform function applying the enforced case
*/
export default function getForcedCaseFn(rule) {
const noop = (input) => input;
if (!rule || !ruleIsActive(rule) || ruleIsNotApplicable(rule)) {
return noop;
}
const target = rule[1][2];
if (Array.isArray(target)) {
return noop;
}
return (input) => toCase(input, target);
}
//# sourceMappingURL=get-forced-case-fn.js.map