Skip to content

Commit 645a487

Browse files
committed
optimize code
1 parent 640b1b5 commit 645a487

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

simple-git-hooks.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ function _setHook(hook, command, projectRoot=process.cwd()) {
211211
/**
212212
* Deletes all git hooks
213213
* @param {string} projectRoot
214-
* @param {string[]} [argv]
215214
*/
216215
function removeHooks(projectRoot = process.cwd()) {
217216
const customConfigPath = _getCustomConfigPath(process.argv)
@@ -222,9 +221,10 @@ function removeHooks(projectRoot = process.cwd()) {
222221
}
223222

224223
const preserveUnused = Array.isArray(config.preserveUnused) ? config.preserveUnused : []
225-
const hooksToRemove = VALID_GIT_HOOKS.filter(hook => !preserveUnused.includes(hook))
226-
for (let configEntry of hooksToRemove) {
227-
_removeHook(configEntry, projectRoot)
224+
for (const configEntry of VALID_GIT_HOOKS) {
225+
if(!preserveUnused.includes(configEntry)) {
226+
_removeHook(configEntry, projectRoot)
227+
}
228228
}
229229
}
230230

0 commit comments

Comments
 (0)