Comparing version 1.2.5 to 1.2.6
@@ -1,1 +0,1 @@ | ||
{"version":2,"languages":{"nodejs-npm":{"specfileHash":"d9ce5de62186c7a0e348fb9bdcf9cbd5","lockfileHash":"6a0189fd81ccf2fca4ca857f45e2f9d6","guessedImports":["node-fetch"],"guessedImportsHash":"51266e8e25b3d5e637d3474eb13a80d8"}}} | ||
{"version":2,"languages":{"nodejs-npm":{"specfileHash":"14be00f7f302ae56d74d77e04b33d8a2","lockfileHash":"9a4836083707bddb00bb058862f05dcb","guessedImports":["node-fetch"],"guessedImportsHash":"d534011cc471dd381a0ecfc25ccd7a0d"}}} |
19
index.js
@@ -13,10 +13,13 @@ const fetch = require("node-fetch") | ||
let data = [] | ||
for(var i = 0; i < type.length; i++){ | ||
if(animals.includes(type[i])){ | ||
img = `https://random-api.nitcord.repl.co/api/img/${type[i]}` | ||
fact = `https://random-api.nitcord.repl.co/api/facts/${type[i]}` | ||
let filteredType = type.filter(function(item, pos){ | ||
return type.indexOf(item) == pos; | ||
}) | ||
for(var i = 0; i < filteredType.length; i++){ | ||
if(animals.includes(filteredType[i].toLowerCase())){ | ||
img = `https://random-api.nitcord.repl.co/api/img/${filteredType[i]}` | ||
fact = `https://random-api.nitcord.repl.co/api/facts/${filteredType[i]}` | ||
const imgData = await fetch(img).then(lang => lang.json()) | ||
const factData = await fetch(fact).then(lang => lang.json()) | ||
let object = {} | ||
object["name"] = type[i] | ||
object["name"] = filteredType[i].toLowerCase() | ||
object["image"] = imgData.link | ||
@@ -31,3 +34,3 @@ object["fact"] = factData.fact | ||
} | ||
if(type == "random"){ | ||
if(type.toLowerCase() == "random"){ | ||
let random = animals[Math.floor(Math.random() * animals.length)] | ||
@@ -46,3 +49,3 @@ img = `https://random-api.nitcord.repl.co/api/img/${random}` | ||
} | ||
if(animals.includes(type)){ | ||
if(animals.includes(type.toLowerCase())){ | ||
const imgData = await fetch(img).then(lang => lang.json()) | ||
@@ -52,3 +55,3 @@ const factData = await fetch(fact).then(lang => lang.json()) | ||
const data = {} | ||
data["name"] = type | ||
data["name"] = type.toLowerCase() | ||
data["image"] = imgData.link | ||
@@ -55,0 +58,0 @@ data["fact"] = factData.fact |
{ | ||
"name": "animality", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "A simple API wrapper that generates images & facts of any animal", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5169
55