From 339645d818d61cf203e2bed7f74f9996236c6967 Mon Sep 17 00:00:00 2001 From: iotcat Date: Sun, 19 Jul 2020 11:41:27 +0800 Subject: [PATCH] add mksec r --- package.json | 2 +- src/.gitignore | 110 +++++++++++++++++++++++++++++++++++++++++++ src/modules/mksec.js | 24 ++++++++++ 3 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/.gitignore diff --git a/package.json b/package.json index 0ae7b8e..bebfece 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mksec", - "version": "2.3.1", + "version": "2.4.0", "main": "src/index.js", "repository": "git@github.com:IoTcat/sentence-generator.git", "author": "iotcat ", diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..04bc789 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,110 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# test files +*.csv + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# data files +data/ + +# TernJS port file +.tern-port diff --git a/src/modules/mksec.js b/src/modules/mksec.js index ee0130d..8c2fde5 100644 --- a/src/modules/mksec.js +++ b/src/modules/mksec.js @@ -76,6 +76,30 @@ module.exports = yargs => { }) + .command('r', "mksec r".green + " Check word list file with random order..", yargs => yargs, async argv => { + + let s = fs.readFileSync(argv._[1], 'utf-8'); + let wArr = s.match(/\b[a-zA-Z]+\b/g); + wArr = wArr.sort(()=>Math.random() - 0.5); + let count = 0; + for(let index = 0; index < wArr.length; index ++){ + wArr[index] = wArr[index].toLowerCase(); + ban = new ora(`Searching ${wArr[index]}...`).start(); + try{ + let arr = (await mksec({word: wArr[index]})); + + count++; + ban.info('Found '+wArr[index]); + }catch(e){ + ban.fail('Not found '+wArr[index]); + } + } + + + ban.succeed('Found '+wArr.length+' words, verified '+ count +' words.'); + + }) +