Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSON.parse instead of safeEval #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var querystring = require('querystring');

var got = require('got');
var safeEval = require('safe-eval');
var token = require('google-translate-token');

var languages = require('./languages');
Expand Down Expand Up @@ -70,7 +69,7 @@ function translate(text, opts) {
result.raw = res.body;
}

var body = safeEval(res.body);
var body = JSON.parse(res.body);
body[0].forEach(function (obj) {
if (obj[0]) {
result.text += obj[0];
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"dependencies": {
"configstore": "^2.0.0",
"google-translate-token": "latest",
"got": "^6.3.0",
"safe-eval": "^0.3.0"
"got": "^6.3.0"
},
"devDependencies": {
"ava": "^0.15.2",
Expand Down