UNPKG

@commitlint/prompt

Version:

commitizen prompt using commitlint.config.js

21 lines 732 B
import { ruleIsActive, ruleIsNotApplicable } from './utils.js'; /** * Get forced leading for rule * @param rule to parse * @return transform function applying the leading */ export default function getForcedLeadingFn(rule) { if (!rule || !ruleIsActive(rule)) { return (input) => input; } const remove = (input) => { const fragments = input.split('\n'); return fragments[0] === '' ? fragments.slice(1).join('\n') : input; }; const lead = (input) => { const fragments = input.split('\n'); return fragments[0] === '' ? input : ['', ...fragments].join('\n'); }; return !ruleIsNotApplicable(rule) ? lead : remove; } //# sourceMappingURL=get-forced-leading-fn.js.map