Skip to content

Commit

Permalink
added a searchWordP function in utility
Browse files Browse the repository at this point in the history
  • Loading branch information
yongli-abc committed Jan 4, 2018
1 parent e22162b commit 7a2cb76
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ var _ = require("lodash");
* {Object} data.explanations.en
* {String} data.explanations.en.key A PoS
* {String[]} data.explanations.en.val An array of explanations for this PoS.
*
*
* Error object
* {Object} error The error object
* {Number} error.status_code The status code
* {String} error.msg The error msg
*/
function searchWordP(word) {
let options = {
Expand Down Expand Up @@ -59,9 +65,16 @@ function searchWordP(word) {
_.get(res, "data.en_definitions"));

return data;
}
})
.catch(function(error) {

})
} else {
let error = {};
_.set(error, "status_code",
_.get(res, "status_code", "unknown status code"));

_.set(error, "msg",
_.get(res, "msg", "unknown msg"));

throw error;
}
});
}

0 comments on commit 7a2cb76

Please sign in to comment.