Socket
Socket
Sign inDemoInstall

baidu-fanyi

Package Overview
Dependencies
8
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

2

dist/index.d.ts

@@ -7,3 +7,3 @@ declare type Lang = 'zh' | 'en';

};
declare class Translater {
export declare class Translater {
private appid;

@@ -10,0 +10,0 @@ private key;

@@ -42,2 +42,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Translater = void 0;
var crypto_1 = require("crypto");

@@ -84,2 +85,4 @@ var axios_1 = __importDefault(require("axios"));

}());
exports.Translater = Translater;
exports.default = Translater;
exports = Translater;
{
"name": "baidu-fanyi",
"version": "0.0.1",
"version": "0.0.2",
"description": "baidu fanyi api on node.js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# baidu-fanyi
baidu fanyi api on node.js
## Usage
```typescript
import Translater from 'baidu-fanyi'
const trans = new Translater('Your Appid', 'Your Key')
trans.translate('hello world', { to: 'zh' })
.then(data => {
console.log(data) // output: '你好,世界'
})
```

@@ -30,7 +30,7 @@ import { createHash } from 'crypto'

class Translater {
export class Translater {
constructor(private appid: string, private key: string) {
}
async translate(q: string, options?: TranslateOption) {
async translate(q: string, options?: TranslateOption): Promise<string> {
const { from = 'auto', to = 'en' } = options ?? {}

@@ -58,1 +58,3 @@ const req: TranslateReq = {

export default Translater
exports = Translater
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",

@@ -9,3 +10,3 @@ "module": "commonjs",

"strict": true,
"esModuleInterop": true
"esModuleInterop": true,
},

@@ -12,0 +13,0 @@ "exclude": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc