Skip to content

Commit a6d0538

Browse files
committed
refactor: use object destructuring rather than omit
1 parent a0a06ed commit a6d0538

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/analyze-commit.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {isMatchWith, isRegExp, omit} = require('lodash');
1+
const {isMatchWith, isRegExp} = require('lodash');
22
const debug = require('debug')('semantic-release:commit-analyzer');
33
const RELEASE_TYPES = require('./default-release-types');
44
const compareReleaseTypes = require('./compare-release-types');
@@ -15,11 +15,13 @@ module.exports = (releaseRules, commit) => {
1515

1616
releaseRules
1717
.filter(
18-
rule =>
19-
(!rule.breaking || (commit.notes && commit.notes.length > 0)) &&
18+
({breaking, release, ...rule}) =>
19+
// If the rule is not `breaking` or the commit doesn't have a breaking change note
20+
(!breaking || (commit.notes && commit.notes.length > 0)) &&
21+
// Otherwise match the regular rules
2022
isMatchWith(
2123
commit,
22-
omit(rule, ['release', 'breaking']),
24+
rule,
2325
(obj, src) =>
2426
/^\/.*\/$/.test(src) || isRegExp(src) ? new RegExp(/^\/(.*)\/$/.exec(src)[1]).test(obj) : undefined
2527
)

0 commit comments

Comments
 (0)