some-random-cat
Advanced tools
Comparing version 1.0.55 to 1.1.0
{ | ||
"name": "some-random-cat", | ||
"version": "1.0.55", | ||
"version": "1.1.0", | ||
"description": "A utility which generates random cat images with a URL", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# some-random-cat | ||
![Total Downloads](https://img.shields.io/npm/dt/some-random-cat?label=Downloads) | ||
A very suitable API to generate random images of cats, dogs and random jokes, facts... A lot more! | ||
@@ -19,5 +21,4 @@ | ||
## Documentation | ||
It will be soon available in v1.1.5 | ||
[Click Here](https://github.com/Aktindo/some-random-cat/blob/main/Docs/SUMMARY.md) | ||
## New features | ||
Soon in v1.1 , A new module called math will be implemented too! | ||
Thinking of adding mroe random things.... Suggestions are welcome! |
@@ -48,2 +48,29 @@ const axios = require('axios') | ||
/** | ||
* @param {String} sub The subreddit! | ||
* @returns {Promise<Pending>} Returns an object too. | ||
*/ | ||
static async newMeme(sub) { | ||
if (!sub) return Promise.reject("Error, you did not specify a subreddit!"); | ||
const start = Date.now(); | ||
const response = await fetch( | ||
`https://imageapi.fionn.cc/reddit/${sub.toLowerCase()}` | ||
).then((res) => res.json()); | ||
const responseTime = Date.now() - start; | ||
if (response.error || response.err) | ||
return Promise.reject("Error, probably due to an invalid subreddit!"); | ||
return { | ||
img: response.img, | ||
res: responseTime, | ||
title: response.title, | ||
upvotes: response.upvotes, | ||
author: response.author, | ||
upvoteRatio: response.upvoteRatio, | ||
comments: response.comments, | ||
downvotes: response.downvotes | ||
}; | ||
} | ||
/** | ||
* @param {Number} number The length of the string | ||
@@ -50,0 +77,0 @@ * @returns {Promise<Pending>} Returns an object too. |
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
Network access
Supply chain riskThis module accesses the network.
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
101927
15
147
23
1