Skip to content

sturdynut/random-cat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Random Cat 😺

Build Status

Summary

A library for generating URLs of random cat pictures.

Although by default this library will generate URLs of random cats, you can specify other categories. All of the categories are listed at the bottom of lorempixel's website. Meow.

Installation

npm install --save random-cat

Usage

var randomCat = require('random-cat');

// Random cat picture of various widths and heights
// Possible values: 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600
// https://lorempixel.com/100/600/cats
var url = randomCat.get();

// Random cat picture of specific size
// https://lorempixel.com/120/600/cats
var urlWithSize = randomCat.get({
  width: 120,
  height: 600
});

// Don't like cats?  Try another category
// Possible values: abstract, animals, business, cats, city, food, nightlife, fashion, people, nature, sports, technics, transport
// https://lorempixel.com/120/500/people
var urlOfPeople = randomCat.get({
  width: 120,
  height: 500,
  category: 'people'
});

// All of the options
// https://lorempixel.com/g/200/700/food/2/om%20nom%20nom
var urlWithAllOptions = randomCat.get({
  width: 200,
  height: 700,
  category: 'food',
  imageIndex: 2,
  dummyText: 'om nom nom',
  gray: true
});

Tests

npm install
npm test

Questions?

@sturdynut

Bugs?

Submit a bug

License

This project is distributed under the MIT license.

About

😸 A lib for generating cat image urls

Resources

License

Stars

Watchers

Forks

Packages

No packages published