UNPKG

980 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 });
6exports.signedOffBy = void 0;
7const message_1 = __importDefault(require("@commitlint/message"));
8const to_lines_1 = __importDefault(require("@commitlint/to-lines"));
9const signedOffBy = (parsed, when = 'always', value = '') => {
10 const lines = to_lines_1.default(parsed.raw).filter((ln) =>
11 // skip comments
12 !ln.startsWith('#') &&
13 // ignore empty lines
14 Boolean(ln));
15 const last = lines[lines.length - 1];
16 const negated = when === 'never';
17 const hasSignedOffBy = last.startsWith(value);
18 return [
19 negated ? !hasSignedOffBy : hasSignedOffBy,
20 message_1.default(['message', negated ? 'must not' : 'must', 'be signed off']),
21 ];
22};
23exports.signedOffBy = signedOffBy;
24//# sourceMappingURL=signed-off-by.js.map
\No newline at end of file