Package Exports
- imgur-random-meme
- imgur-random-meme/index.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 (imgur-random-meme) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
random-puppy 
Get a random puppy image url.
Install
$ npm install --save random-puppyUsage
const randomPuppy = require('random-puppy');
randomPuppy()
.then(url => {
console.log(url);
})
//=> 'http://imgur.com/IoI8uS5.jpg'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