Sha256: dd7dc6eb95201039f36badec6096c98c216b6d4a0de187442afab161636c7434
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
import { case as ensureCase } from '@commitlint/ensure'; import message from '@commitlint/message'; const negated = (when) => when === 'never'; export const bodyCase = (parsed, when = 'always', value = []) => { const { body } = parsed; if (!body) { return [true]; } const checks = (Array.isArray(value) ? value : [value]).map((check) => { if (typeof check === 'string') { return { when: 'always', case: check, }; } return check; }); const result = checks.some((check) => { const r = ensureCase(body, check.case); return negated(check.when) ? !r : r; }); const list = checks.map((c) => c.case).join(', '); return [ negated(when) ? !result : result, message([`body must`, negated(when) ? `not` : null, `be ${list}`]), ]; }; //# sourceMappingURL=body-case.js.map
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pcp-server-ruby-sdk-0.0.6 | node_modules/@commitlint/rules/lib/body-case.js |
pcp-server-ruby-sdk-0.1.0 | node_modules/@commitlint/rules/lib/body-case.js |