-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2618857
commit ee54179
Showing
8 changed files
with
60 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
import supervillainsJson = require('./supervillains.json'); | ||
/** | ||
Supervillain names in alphabetical order. | ||
declare const supervillains: { | ||
/** | ||
Supervillain names in alphabetical order. | ||
@example | ||
``` | ||
import supervillains from 'supervillains'; | ||
@example | ||
``` | ||
const supervillains = require('supervillains'); | ||
supervillains; | ||
//=> ['Abattoir', 'Able Crown', …] | ||
``` | ||
*/ | ||
declare const supervillains: readonly string[]; | ||
|
||
supervillains.all; | ||
//=> ['Abattoir', 'Able Crown', …] | ||
``` | ||
*/ | ||
readonly all: Readonly<typeof supervillainsJson>; | ||
/** | ||
Get a random supervillain name. | ||
/** | ||
Random supervillain name. | ||
@example | ||
``` | ||
import {randomSupervillain} from 'supervillains'; | ||
@example | ||
``` | ||
const supervillains = require('supervillains'); | ||
supervillains.random(); | ||
//=> 'Mud Pack' | ||
``` | ||
*/ | ||
random(): Readonly<typeof supervillainsJson>[number]; | ||
}; | ||
|
||
export = supervillains; | ||
randomSupervillain(); | ||
//=> 'Mud Pack' | ||
``` | ||
*/ | ||
export function randomSupervillain(): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
'use strict'; | ||
const uniqueRandomArray = require('unique-random-array'); | ||
const supervillains = require('./supervillains.json'); | ||
import uniqueRandomArray from 'unique-random-array'; | ||
import supervillains from './supervillains.json' with {type: 'json'}; | ||
|
||
exports.all = supervillains; | ||
exports.random = uniqueRandomArray(supervillains); | ||
export default supervillains; | ||
|
||
export const randomSupervillain = uniqueRandomArray(supervillains); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import test from 'ava'; | ||
import supervillains from '.'; | ||
import supervillains, {randomSupervillain} from './index.js'; | ||
|
||
test('main', t => { | ||
t.true(supervillains.all.length > 0); | ||
t.true(supervillains.all.includes('Mud Pack')); | ||
t.truthy(supervillains.random()); | ||
t.true(supervillains.length > 0); | ||
t.true(supervillains.includes('Mud Pack')); | ||
t.truthy(randomSupervillain()); | ||
}); |