check-chinese
Advanced tools
Comparing version 1.0.2 to 1.0.3
28
index.js
@@ -6,17 +6,21 @@ #!/usr/bin/env node | ||
// 测试1 | ||
function walkSync(currentDirPath, callback) { | ||
// http://nodejs.cn/api/fs.html#fsreaddirsyncpath-options | ||
// http://nodejs.cn/api/fs.html#class-fsdirent 新增于: v10.10.0 | ||
fs.readdirSync(currentDirPath, { withFileTypes: true }).forEach(function ( | ||
dirent | ||
) { | ||
var filePath = path.join(currentDirPath, dirent.name); | ||
if (dirent.isFile()) { | ||
callback(filePath, dirent); | ||
} else if (dirent.isDirectory()) { | ||
walkSync(filePath, callback); | ||
} | ||
}); | ||
try { | ||
fs.readdirSync(currentDirPath, { withFileTypes: true }).forEach(function ( | ||
dirent | ||
) { | ||
var filePath = path.join(currentDirPath, dirent.name); | ||
if (dirent.isFile()) { | ||
callback(filePath, dirent); | ||
} else if (dirent.isDirectory()) { | ||
walkSync(filePath, callback); | ||
} | ||
}); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} | ||
// 测试2 | ||
walkSync(process.argv[2], function (filePath, stat) { | ||
@@ -23,0 +27,0 @@ const file = fs.readFileSync(filePath, "utf8"); |
{ | ||
"name": "check-chinese", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38
1242