Adjust documentation
This commit is contained in:
parent
58f4e629d8
commit
6ae96eb38d
1 changed files with 14 additions and 1 deletions
15
readme.md
15
readme.md
|
@ -12,13 +12,20 @@ $ npm install --save random-bunny
|
|||
## Usage
|
||||
|
||||
```js
|
||||
const randomBunny = require('random-bunny');
|
||||
const { randomBunny } = require('random-bunny');
|
||||
|
||||
randomBunny('rabbits', 'new', res => {
|
||||
console.log(res.title + ": " + res.url);
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
const { promise } = require('random-bunny');
|
||||
|
||||
promise('rabbits', 'new').then((res) => {
|
||||
console.log(res.title);
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
|
@ -37,6 +44,12 @@ The json string which gets returned consists of:
|
|||
- ups
|
||||
- url
|
||||
|
||||
### `promise()`
|
||||
|
||||
Returns a `json string` for a random post in a `promise`. Accepts 2 arguments: `subreddit`, `sortby` ('new', 'hot', 'top').
|
||||
|
||||
The json string returned in the promise consists of the same above.
|
||||
|
||||
## Notes
|
||||
|
||||
* Node 4 or newer.
|
||||
|
|
Loading…
Reference in a new issue