animality-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

animality-js

A simple API wrapper that generates images & facts of any animal

Installation

$ npm install animality

The Node.js wrapper for this API is available for use in Node Package Manager. It's use is pretty straight-forward.

Usage

These are the 17 animal strings that can be used to send a request to the API:

  • cat
  • dog
  • bird
  • panda
  • redpanda
  • koala
  • fox
  • whale
  • dolphin
  • kangaroo
  • bunny
  • lion
  • bear
  • frog
  • duck
  • penguin
  • axolotl

Example

const {Animality} = require('animality');
const animal = 'cat';
Animality.getAsync(animal, 'API_KEY').then(console.log);

This outputs the following object in the terminal:

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

const {Animality} = require('animality');
const animals = ['cat', 'dog', 'panda'];
Animality.getAsync(animals, 'API_KEY').then(console.log);

This outputs the following array of objects in the terminal:

[
  {
    "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"
  }
]

Package Sidebar

Install

npm i animality-ts

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

10.8 kB

Total Files

11

Last publish

Collaborators

  • takiyo