Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asksuite-translate-json-object

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asksuite-translate-json-object - npm Package Compare versions

Comparing version 0.0.2-development to 0.0.3-development

lib/service/microsoft.js

14

lib/translate-json-object.js

@@ -27,5 +27,10 @@ var _ = require('lodash');

function init(options) {
setting = options || {};
if (!setting.googleApiKey && !setting.yandexApiKey) {
if (!setting.googleApiKey && !setting.yandexApiKey && !setting.msKey) {
console.warn(constant.ERROR.MISSING_TOKEN);

@@ -36,5 +41,8 @@ return false;

translateSrv = require('./service/yandex.js');
} else {
} else if (setting.googleApiKey) {
serviceType = constant.GOOGLE_NAME;
translateSrv = require('./service/google.js');
} else if (setting.msKey) {
serviceType = constant.MS_NAME;
translateSrv = require('./service/microsoft.js');
}

@@ -55,3 +63,3 @@

function translate(srcObj, language, attributesToNotTranslate) {
if (!setting.googleApiKey && !setting.yandexApiKey) {
if (!setting.googleApiKey && !setting.yandexApiKey && !setting.msKey) {
return Promise.reject(constant.ERROR.MISSING_TOKEN);

@@ -58,0 +66,0 @@ }

module.exports = {
GOOGLE_NAME: 'Google',
YANDEX_NAME: 'Yandex',
MS_NAME: 'Microsoft',
ERROR: {

@@ -5,0 +6,0 @@ MISSING_TOKEN: 'Please provide a option.googleApiKey, or option.yandexApiKey (token key) via invoking the [init] method'

@@ -12,2 +12,4 @@ var constant = require('./constant');

return yandex.indexOf(lang) !== -1;
case constant.MS_NAME:
return google.indexOf(lang) !== -1;
default:

@@ -14,0 +16,0 @@ return false;

{
"name": "asksuite-translate-json-object",
"version": "0.0.2-development",
"version": "0.0.3-development",
"description": "Translate a JSON object to any language via google or yandex translate API",

@@ -18,2 +18,3 @@ "main": "lib/translate-json-object.js",

"lodash": "4.17.3",
"mstranslator": "^3.0.0",
"promise": "7.1.1",

@@ -20,0 +21,0 @@ "yandex-translate": "2.1.1"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc