Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

random-puppy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-puppy

Get a random imgur image url, by default a puppy.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548
increased by141.41%
Maintainers
1
Weekly downloads
 
Created
Source

random-puppy Build Status

Get a random puppy image url.

Install

$ npm install --save random-puppy

Usage

const randomPuppy = require('random-puppy');

randomPuppy()
    .then(url => {
        console.log(url);
    })

//=> 'http://imgur.com/IoI8uS5'

API

randomPuppy()

Returns a promise for a random puppy image url from http://imgur.com/ from https://www.reddit.com/r/puppy

randomPuppy(subreddit)

Returns a promise for a random image url from the selected subreddit. Warning: We cannot promise it will be a image of a puppy!

randomPuppy.all(subreddit)

Returns an eventemitter for getting all random images for a subreddit.

const event = randomPuppy.all(subreddit);
event.on('data', url => console.log(url));

Or:

const event = randomPuppy.all('puppies');

Observable.fromEvent(event, 'data')
    .subscribe(data => {
      console.log(data);
    });

Notes

  • Node 4 or newer.
  • Caches results from imgur in memory.
  • Created for the purpose of using in a training exercise on different ways to do async in JavaScript at Opower.

License

MIT © Dylan Greene

Keywords

FAQs

Package last updated on 29 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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