Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

some-random-cat

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

some-random-cat - npm Package Compare versions

Comparing version 1.0.55 to 1.1.0

index.d.ts

2

package.json
{
"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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc