JSPM

cats-js

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q33961F
  • License GPL-3.0

Wrapper for The Cat API

Package Exports

  • cats-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cats-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cats-js

Node.js module that provides an API wrapper for The Cat API.

NPM

Features

  • Get random cats
  • Save & load cats you like
  • 100% promise based
  • JSON Output
  • And more!

Simple Example

var cats = require("cats-js");

var c = new cats();

c.get().then((cat) => {console.log(cat)});

Output

{ images:
  { image: 
    { url: 'http://24.media.tumblr.com/tumblr_m34d23c4x21qhwmnpo1_500.jpg',
      id: '42p',
      source_url: 'http://thecatapi.com/?id=42p'
    }
  }
}

More complex example

var cats = require("cats-js");

var c = new cats();

c.get({results_per_page: 10, type: "gif"}).then((cats) => {console.log(cats)});

Output

{ images:
   { image:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] 
      ]
   }
}

See docs/index.html for a detailed documentation!