@forsakringskassan/commitlint-config 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/parser.js +18 -1
  2. package/package.json +1 -1
package/dist/parser.js CHANGED
@@ -285,12 +285,29 @@ import { resolve } from "path";
285
285
  import { fileURLToPath } from "url";
286
286
 
287
287
  // node_modules/conventional-changelog-conventionalcommits/src/utils.js
288
+ function hasIntersection(a, b) {
289
+ if (!a || !b) {
290
+ return false;
291
+ }
292
+ let listA = a;
293
+ let listB = b;
294
+ if (!Array.isArray(listA)) {
295
+ listA = [listA];
296
+ }
297
+ if (!Array.isArray(listB)) {
298
+ listB = [listB];
299
+ }
300
+ return listA.some((item) => listB.includes(item));
301
+ }
288
302
  function matchScope(config = {}, commit) {
289
303
  const {
290
304
  scope: targetScope,
291
305
  scopeOnly = false
292
306
  } = config;
293
- const includesScope = commit.scope?.split(",").includes(targetScope);
307
+ const includesScope = hasIntersection(
308
+ commit.scope?.split(","),
309
+ targetScope
310
+ );
294
311
  return !targetScope || scopeOnly && includesScope || !scopeOnly && (!commit.scope || includesScope);
295
312
  }
296
313
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/commitlint-config",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "FK commitlint shareable config",
5
5
  "keywords": [
6
6
  "commitlint"