ruins
Version:
> [!IMPORTANT] > This is in beta. Not everything is ironed out and some modules might misbehave
12 lines • 492 B
JavaScript
/**
* Parse conventional commit, returns undefined if not valid, its parts if valid
*/
export const parseConventionalCommit = (message) => {
const conventionalCommitRegex = /^(?<type>\w+)(\((?<scope>[^)]+)\))?: (?<description>.+)$/;
const match = message.match(conventionalCommitRegex);
if (!match || !match.groups)
return;
const { type, scope, description } = match.groups;
return { type, scope, description };
};
//# sourceMappingURL=conventional-commit.js.map