Skip to content

Commit cbd33a4

Browse files
author
Guillaume Chau
committed
fix: code polish
1 parent 3b6d5b2 commit cbd33a4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/@vue/cli/lib/util/module.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ function resolveFallback (request, options) {
77

88
const paths = []
99

10-
for (var i = 0; i < options.paths.length; i++) {
10+
for (let i = 0; i < options.paths.length; i++) {
1111
const path = options.paths[i]
1212
fakeParent.paths = Module._nodeModulePaths(path)
1313
const lookupPaths = Module._resolveLookupPaths(request, fakeParent, true)
1414

1515
if (!paths.includes(path)) paths.push(path)
1616

17-
for (var j = 0; j < lookupPaths.length; j++) {
17+
for (let j = 0; j < lookupPaths.length; j++) {
1818
if (!paths.includes(lookupPaths[j])) paths.push(lookupPaths[j])
1919
}
2020
}
2121

22-
var filename = Module._findPath(request, paths, isMain)
22+
const filename = Module._findPath(request, paths, isMain)
2323
if (!filename) {
24-
var err = new Error(`Cannot find module '${request}'`)
24+
const err = new Error(`Cannot find module '${request}'`)
2525
err.code = 'MODULE_NOT_FOUND'
2626
throw err
2727
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
exports.minNode = function (major, minor = 0, patch = 0) {
2-
const parts = process.versions.node.split('.').map(v => parseInt(v))
3-
if (parts[0] >= major && parts[1] >= minor && parts[2] >= patch) return true
4-
return false
2+
const [M, m, p] = process.versions.node.split('.').map(v => parseInt(v))
3+
return (M >= major && m >= minor && p >= patch)
54
}

0 commit comments

Comments
 (0)