function parseMessage()

in commitlint.config.js [40:52]


function parseMessage(message) {
  const PATTERN = /(\w*)(?:\((.*)\))?: (.*)$/;
  const header = message.split('\n')[0];
  const match = PATTERN.exec(header);
  if (match) {
    return {
      type: match[1] || null,
      scope: match[2] || null,
      subject: match[3] || null
    };
  }
  return null;
}