1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.signedOffBy = void 0;
|
7 | const message_1 = __importDefault(require("@commitlint/message"));
|
8 | const to_lines_1 = __importDefault(require("@commitlint/to-lines"));
|
9 | const signedOffBy = (parsed, when = 'always', value = '') => {
|
10 | const lines = to_lines_1.default(parsed.raw).filter((ln) =>
|
11 |
|
12 | !ln.startsWith('#') &&
|
13 |
|
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 | };
|
23 | exports.signedOffBy = signedOffBy;
|
24 |
|
\ | No newline at end of file |