ding-trans
Advanced tools
Comparing version 1.0.41 to 1.0.42
#! /usr/bin/env node | ||
require("colors"); | ||
@@ -7,4 +6,8 @@ const say = require("say"); | ||
const argv = require("yargs").argv; | ||
let queryStr = encodeURI(argv._.join(" ")); | ||
// 对驼峰的连续单词进行分割后转义 | ||
let queryStr = encodeURI( | ||
argv._.join(" ") | ||
.replace(/([A-Z])/g, " $1") | ||
.toLowerCase() | ||
); | ||
// 无参数,或帮助 | ||
@@ -30,8 +33,5 @@ if (!queryStr || argv.help == true || argv.H == true || argv.h == true) { | ||
} | ||
// 对驼峰的连续单词进行分割后转义 | ||
// queryStr = encodeURI(queryStr.replace(/([A-Z])/g, " $1").toLowerCase()); | ||
//查词 | ||
sendInfo(queryStr); | ||
} | ||
//格式化 | ||
@@ -68,3 +68,2 @@ function format(json) { | ||
} | ||
//发送请求 | ||
@@ -74,3 +73,2 @@ function sendInfo(query) { | ||
let http = require("http"); | ||
// 1.用于请求的选项 | ||
@@ -85,3 +83,2 @@ let options = { | ||
// let options = ` http://aidemo.youdao.com/trans?q=${query}&&from=Auto&&to=Auto`; | ||
// 处理响应的回调函数 | ||
@@ -88,0 +85,0 @@ let callback = function (response) { |
{ | ||
"name": "ding-trans", | ||
"version": "1.0.41", | ||
"version": "1.0.42", | ||
"description": "a translation cli", | ||
@@ -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
92
4187