Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

animality

Package Overview
Dependencies
7
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.5 to 1.5.6

2

package.json
{
"name": "animality",
"version": "1.5.5",
"version": "1.5.6",
"description": "A simple API wrapper that generates images & facts of any animal",

@@ -5,0 +5,0 @@ "main": "index.js",

# animality
A simple API wrapper that generates images & facts of any animal
# Installation
Use the package manager [npm](https://www.npmjs.com/) to install `animality`.
```bash
$ npm i animality
$ npm install animality
```
# Require
The Node.js wrapper for this API is available for use in [Node Package Manager](https://www.npmjs.com/package/animality). It's use is pretty straight-forward.
```js
const animality = require('animality');
```
# Usage
These are the 15 animal strings that can be used to send a request to the API.
### Animals:
* `cat`
* `dog`
* `dog`
* `bird`

@@ -38,57 +30,47 @@ * `panda`

## Get one or multiple animal images and facts
# Example
```js
const animality = require('animality');
// Singular animal.
const animal = 'cat';
animality.getAsync(animal).then(console.log);
/*
Output:
{
name: 'cat',
image: 'An image URL here',
fact: 'A fact here'
}
*/
```
// Multiple animals can also be used.
This outputs the following object in the terminal:
```json
{
"name": "cat",
"image": "An image URL here",
"fact": "A fact here"
}
```
Other than that, this package also allows you to request multiple animals at the same time.
```js
const animality = require('animality');
const animals = ['cat', 'dog', 'panda'];
animality.getAsync(animals).then(console.log);
/*
Output:
[
{
name: 'cat',
image: 'An image URL here',
fact: 'A fact here'
},
{
name: 'dog',
image: 'An image URL here',
fact: 'A fact here'
},
{
name: 'panda',
image: 'An image URL here',
fact: 'A fact here'
}
]
*/
```
// A random animal type.
const animal = 'random';
This outputs the following array of objects in the terminal:
animality.getAsync(animal).then(console.log);
/*
Output:
```json
[
{
name: 'redpanda',
image: 'An image URL here',
fact: 'A fact here'
"name": "cat",
"image": "An image URL here",
"fact": "A fact here"
},
{
"name": "dog",
"image": "An image URL here",
"fact": "A fact here"
},
{
"name": "panda",
"image": "An image URL here",
"fact": "A fact here"
}
*/
]
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc