Comparing version 1.0.0 to 1.0.1
49
index.js
@@ -1,16 +0,55 @@ | ||
// German Chinese Spanish Italian | ||
// de,zh,es,it | ||
// German Chinese Spanish Italian English | ||
// de,zh,es,it,en | ||
//https://random-word-api.herokuapp.com/word?number=10&swear=0&lang=en | ||
module.exports.Generate = async function(AmountOfWords, ExplicitWords, Language) { | ||
module.exports.Generate = async function(AmountOfWords, ExplicitWords, Language) { | ||
const axios = require('axios') | ||
const SupportedLanuages = [ | ||
"de", | ||
"zh", | ||
"es", | ||
"it", | ||
"en" | ||
] | ||
var ExplicitNumber = 0 | ||
if (AmountOfWords) { | ||
if (!isNaN(AmountOfWords)) { | ||
console.log("number") | ||
if (ExplicitWords) { | ||
if (ExplicitWords === true) { | ||
ExplicitNumber = 1 | ||
} else if (ExplicitWords === false) { | ||
ExplicitNumber = 0 | ||
} else { | ||
ExplicitNumber = 0 | ||
} | ||
} else { | ||
ExplicitNumber = 0 | ||
} | ||
if (Language) { | ||
if (SupportedLanuages.includes(Language)) { | ||
Language = Language | ||
} else { | ||
console.log("ERROR: Entered language is not supported yet.\n\nFIX: Try using any of these languages: de , zh , es , it , en\n\nLanguage defaulted to en (English)") | ||
Language = 'en' | ||
} | ||
} else { | ||
Language = 'en' | ||
} | ||
var result; | ||
await axios | ||
.get('https://random-word-api.herokuapp.com/word?number=' + AmountOfWords.toString() + '&swear=' + ExplicitNumber.toString() + '&lang=' + Language) | ||
.then((response) => { | ||
result = response | ||
}) | ||
return result; | ||
} else { | ||
console.log('not a number') | ||
console.log("ERROR: Parameter #1 of the .Generate() function is not a valid Number.\n\nFIX: Enter the amount of words that you want to generate in the 1st parameter of the .Generate() function\n\n Amount of Words Defaulted to 1") | ||
} | ||
} | ||
} |
{ | ||
"name": "new-words", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "robertcodez", | ||
"license": "ISC" | ||
} | ||
"name": "new-words", | ||
"version": "1.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "robertcodez", | ||
"license": "ISC", | ||
"dependencies": { | ||
"axios": "^0.26.1" | ||
} | ||
} |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2229
47
0
1
+ Addedaxios@^0.26.1
+ Addedaxios@0.26.1(transitive)
+ Addedfollow-redirects@1.15.9(transitive)