Skip to content

Commit 854f673

Browse files
authored
refactor: remove lodash.isfunction dependency (#4604)
Replace lodash.isfunction with native typeof check in Process.test.ts to reduce dependencies and improve code consistency with existing typeof checks in the same file
1 parent 1828d6e commit 854f673

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

@commitlint/cz-commitlint/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@
5656
},
5757
"devDependencies": {
5858
"@types/inquirer": "^9.0.7",
59-
"@types/lodash.isfunction": "^3.0.8",
60-
"commitizen": "^4.2.4",
61-
"lodash.isfunction": "^3.0.9"
59+
"commitizen": "^4.2.4"
6260
},
6361
"gitHead": "e82f05a737626bb69979d14564f5ff601997f679"
6462
}

@commitlint/cz-commitlint/src/Process.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
UserPromptConfig,
66
} from "@commitlint/types";
77
import { Answers, DistinctQuestion } from "inquirer";
8-
import isFunction from "lodash.isfunction";
98

109
import process from "./Process.js";
1110

@@ -20,7 +19,7 @@ const mockPrompt = vi.fn(async function (
2019
for (const { name, message, when, filter, validate } of questions) {
2120
if (typeof when !== "function" || (await when(answers))) {
2221
const title =
23-
message && isFunction(message)
22+
message && typeof message === "function"
2423
? await message(answers)
2524
: typeof message === "string"
2625
? message

yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,13 +1858,6 @@
18581858
resolved "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76"
18591859
integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==
18601860

1861-
"@types/lodash.isfunction@^3.0.8":
1862-
version "3.0.9"
1863-
resolved "https://registry.npmjs.org/@types/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#527e51ab6638b38c65a03ec218232b1a787cc9bc"
1864-
integrity sha512-BLaDvlY09jnPND1wxlGXPrPl2CN4M7qGRah7Tb/rtB1vnLyZmtcw3FRPSUkDsd5n4e+2E5BBrr0ICfYR+S4hZQ==
1865-
dependencies:
1866-
"@types/lodash" "*"
1867-
18681861
"@types/lodash.mergewith@^4.6.8":
18691862
version "4.6.9"
18701863
resolved "https://registry.npmjs.org/@types/lodash.mergewith/-/lodash.mergewith-4.6.9.tgz#7093028a36de3cae4495d03b9d92c351cab1f8bf"
@@ -5395,11 +5388,6 @@ lodash.clonedeep@^4.5.0:
53955388
resolved "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
53965389
integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==
53975390

5398-
lodash.isfunction@^3.0.9:
5399-
version "3.0.9"
5400-
resolved "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051"
5401-
integrity sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==
5402-
54035391
lodash.ismatch@^4.4.0:
54045392
version "4.4.0"
54055393
resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"

0 commit comments

Comments
 (0)