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.0 to 1.0.1

8

examples/example.js

@@ -1,4 +0,4 @@

const { Random } = require("../src/app")
const random = new Random()
let cat = random.getCat()
console.log(cat)
const random = require('../index')
random.Random.newCat()
.then(res => console.log(res))
.catch(e => console.error(e))
{
"name": "some-random-cat",
"version": "1.0.0",
"version": "1.0.1",
"description": "A utility which generates random cat images with a URL",

@@ -13,2 +13,9 @@ "main": "index.js",

},
"keywords": [
"randomapi",
"something-random",
"some-random-cat",
"some-random",
"random"
],
"author": "Aktindo",

@@ -15,0 +22,0 @@ "license": "ISC",

��# some-random-cat
A very suitable API to generate random images of cats, dogs and random jokes, facts... A lot more!
**Author:** Aktindo
**Dependencies:** axios
**Versions:** v1.0.0 (current)
## How to use it? (Example)
Generate a random picture of cat:
```javascript
const somethingRandom = require('some-random-cat')
somethingRandom.Random.newCat()
.then(res => console.log(res)) // The function returns a pending promise and can be logged using .then
.catch(e => console.error(e)) // Catch the error
```
## Documentation
It will be soon available in v1.1.0
const axios = require('axios')
class Random {
async newCat() {
/**
* Please do not instantiate this class. You can access it by doing require('some-random-cat').Random
*/
/*
* <warn>Static class</warn>
*/
constructor() {
throw new Error('RandomAPIError: You may not instantiate this class!')
}
static async newCat() {
const res = await axios.get('https://api.thecatapi.com/v1/images/search?format=json')

@@ -5,0 +17,0 @@ let data = res.data[0].url

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