Skip to content

Commit

Permalink
Change the API
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 14, 2018
1 parent bd590ca commit aaf72e0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
const uniqueRandomArray = require('unique-random-array');
const words = require('./words.json');

module.exports = uniqueRandomArray(words);
module.exports.words = words;
module.exports.all = words;
module.exports.random = uniqueRandomArray(words);
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"words",
"list",
"array",
"random",
"rand"
"random"
],
"dependencies": {
"unique-random-array": "^1.0.0"
Expand Down
19 changes: 9 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,29 @@ $ npm install superb
```js
const superb = require('superb');

superb();
superb.random();
//=> 'legendary'

superb();
superb.random();
//=> 'awesome'

superb.words;
superb.all;
//=> ['superb', 'legendary', …]
```


## API

### superb()
### .all

Type: `string`
Type: `Array`

Random [superb like word](words.json).
All the words in alphabetical order.

### superb.words
### .random()

Type: `Array`
Type: `Function`

All the words.
Random word.


## Related
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava';
import superb from '.';

test('main', t => {
t.true(superb().length > 0);
t.true(Array.isArray(superb.words));
t.true(superb.words[3].length > 0);
t.true(superb.random().length > 0);
t.true(Array.isArray(superb.all));
t.true(superb.all[3].length > 0);
});

0 comments on commit aaf72e0

Please sign in to comment.