diff options
author | Minteck <nekostarfan@gmail.com> | 2021-09-25 01:21:57 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-09-25 01:21:57 +0200 |
commit | d69f9f9450ae8f4044b3b6a53dd296e8ec80eb2b (patch) | |
tree | bf60603683e6a8560f0d379e62790d7961b1e11d | |
parent | cc8732f7ca677cef43ae30e302874d1e95affb2e (diff) | |
download | metranslator-api-d69f9f9450ae8f4044b3b6a53dd296e8ec80eb2b.tar.gz metranslator-api-d69f9f9450ae8f4044b3b6a53dd296e8ec80eb2b.tar.bz2 metranslator-api-d69f9f9450ae8f4044b3b6a53dd296e8ec80eb2b.zip |
Little Small Fixes
-rw-r--r-- | database.json | 5 | ||||
-rw-r--r-- | index.js | 49 |
2 files changed, 39 insertions, 15 deletions
diff --git a/database.json b/database.json index d058a70..b744187 100644 --- a/database.json +++ b/database.json @@ -894,6 +894,11 @@ "fact": null }, { + "en": " so ", + "mt": " nosiv ", + "fact": null + }, + { "en": " of ", "mt": " tigev ", "fact": null @@ -1,3 +1,5 @@ +const startTime = new Date(); + class MetranslatorInitializationError extends Error { constructor(message) { super(message); @@ -7,9 +9,15 @@ class MetranslatorInitializationError extends Error { switch (process.argv[2]) { case "debug": debug = true + api = false break; case "release": debug = false + api = false + break; + case "api": + debug = false + api = true break; default: throw new MetranslatorInitializationError("Debugging level not defined or invalid") @@ -39,6 +47,7 @@ let output = { length: db.phrases.length }, facts: [], + duration: null, output: null } @@ -74,19 +83,29 @@ if (toMetroz) { } } -console.log("") output.output = query.trim().replaceAll(" !", "!").replaceAll(" ?", "?").replaceAll(" ,", ",").replaceAll(" .", ".").replaceAll("[{[", "").replaceAll("]}]", ""); -if (debug){ - console.dir(output); -}else{ - console.log("*") - console.log("| "+JSON.stringify(db._name).replaceAll('"','')) - console.log("| Version: " + JSON.stringify(db._version).replaceAll('"','')) - console.log("| Made by Jamez and Minteck!") - console.log("| check minteck out here: https://minteck.ro.lt/git/minteck") - console.log("*") - console.log("") - console.log("Fun Fact: " + JSON.stringify(output['facts'])) - console.log("") - console.log("RESULT: " + JSON.stringify(output['output']).replaceAll('"','')) - }
\ No newline at end of file + +const endTime = new Date(); +const diffTime = (endTime - startTime).toFixed(2); + +output.duration = endTime - startTime; + +if (debug) { + console.log("") + console.dir(output); +} else if (api) { + console.log(JSON.stringify(output).trim()); +} else { + console.log("") + console.log("*") + console.log("| "+JSON.stringify(db._name).replaceAll('"','')) + console.log("| Database version: " + JSON.stringify(db._version).replaceAll('"','')) + console.log("| Made by Jamez and Minteck!") + console.log("| Source: https://minteck.ro.lt/git/minteck/metranslator-api") + console.log("*") + console.log("") + console.log("Done in " + diffTime + " ms"); + console.log("Fun Facts:\n - " + output['facts'].join("\n - ")) + console.log("") + console.log("Output: " + output['output']) +}
\ No newline at end of file |