+31
| #!/usr/bin/env node | ||
| const path = require('path') | ||
| const pkg = require(path.resolve(__dirname, './package.json')) | ||
| const output = require(path.resolve(__dirname, './lib/output.js')) | ||
| const wordp = require(path.resolve(__dirname, './lib/wordp.js')) | ||
| const argv = require(path.resolve(__dirname, './lib/argv.js')) | ||
| const fs = require('fs') | ||
| const dic = fs.readFileSync(path.resolve(__dirname, './dic'), 'utf8') | ||
| const word = argv.get('--word') || argv.get('-w') || argv.param(0) | ||
| if (argv.is('-v') || argv.is('--version')) { | ||
| output.ok(pkg.version) | ||
| } else if (argv.is('-h') || argv.is('--help')) { | ||
| output.ok('Just pass your word after cli command.') | ||
| } else if (word) { | ||
| wordp.search(dic, word).then(words => { | ||
| const userOutputPath = argv.get('--output') || argv.get('-o') | ||
| if (userOutputPath) { | ||
| const outputPath = path.resolve(process.cwd(), userOutputPath) | ||
| fs.writeFileSync(outputPath, words.join("\n")) | ||
| output.ok(outputPath + ' created!') | ||
| } else { | ||
| output.ok("\n" + words.join("\n")) | ||
| } | ||
| }).catch(err => { | ||
| output.error(err) | ||
| }) | ||
| } else { | ||
| output.error('Unhandled parameters.') | ||
| } |
+3
-26
@@ -1,31 +0,8 @@ | ||
| #!/usr/bin/env node | ||
| const path = require('path') | ||
| const pkg = require(path.resolve(__dirname, './package.json')) | ||
| const output = require(path.resolve(__dirname, './lib/output.js')) | ||
| const fs = require('fs') | ||
| const wordp = require(path.resolve(__dirname, './lib/wordp.js')) | ||
| const argv = require(path.resolve(__dirname, './lib/argv.js')) | ||
| const fs = require('fs') | ||
| const dic = fs.readFileSync(path.resolve(__dirname, './dic'), 'utf8') | ||
| const word = argv.get('--word') || argv.get('-w') || argv.param(0) | ||
| if (argv.is('-v') || argv.is('--version')) { | ||
| output.ok(pkg.version) | ||
| } else if (argv.is('-h') || argv.is('--help')) { | ||
| output.ok('Just pass your word after cli command.') | ||
| } else if (word) { | ||
| wordp.search(dic, word).then(words => { | ||
| const userOutputPath = argv.get('--output') || argv.get('-o') | ||
| if (userOutputPath) { | ||
| const outputPath = path.resolve(process.cwd(), userOutputPath) | ||
| fs.writeFileSync(outputPath, words.join("\n")) | ||
| output.ok(outputPath + ' created!') | ||
| } else { | ||
| output.ok("\n" + words.join("\n")) | ||
| } | ||
| }).catch(err => { | ||
| output.error(err) | ||
| }) | ||
| } else { | ||
| output.error('Unhandled parameters.') | ||
| module.exports = function(word) { | ||
| return wordp.search(dic, word) | ||
| } |
+2
-2
| { | ||
| "name": "fand", | ||
| "version": "0.0.3", | ||
| "version": "0.1.1", | ||
| "description": "Simple cli app to search easily in persian words.", | ||
| "main": "index.js", | ||
| "bin": "index.js", | ||
| "bin": "bin.js", | ||
| "scripts": { | ||
@@ -8,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
75452
0.34%8
14.29%129
4.88%8
33.33%