-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (24 loc) · 712 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Dependencies
const Axios = require("axios")
//Variables
async function detect(word = String){
var result;
try{
const response = await Axios({
method: "GET",
url: `https://languagelayer.com/php_helper_scripts/language_api.php?secret_key=f39483d3777fe9b6c00b867482bef5b7&query=${word}`
})
result = response.data
}catch{
const response = await Axios({
method: "GET",
url: `https://languagelayer.com/php_helper_scripts/language_api.php?secret_key=f39483d3777fe9b6c00b867482bef5b7&query=${encodeURI(word)}`
})
result = response.data
}
return result
}
//Exporter
module.exports = {
detect
}