-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
67ef63e
commit 2d06287
Showing
8 changed files
with
63 additions
and
75 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,27 @@ | ||
import superheroesJson = require('./superheroes.json'); | ||
/** | ||
Superhero names in alphabetical order. | ||
declare const superheroes: { | ||
/** | ||
Superhero names in alphabetical order. | ||
@example | ||
``` | ||
import superheroes from 'superheroes'; | ||
@example | ||
``` | ||
import superheroes = require('superheroes'); | ||
superheroes; | ||
//=> ['3-D Man', 'A-Bomb', …] | ||
``` | ||
*/ | ||
declare const superheroes: readonly string[]; | ||
|
||
superheroes.all; | ||
//=> ['3-D Man', 'A-Bomb', …] | ||
``` | ||
*/ | ||
readonly all: Readonly<typeof superheroesJson>; | ||
export default superheroes; | ||
|
||
/** | ||
Random superhero name. | ||
/** | ||
Get a random superhero name. | ||
@example | ||
``` | ||
import superheroes = require('superheroes'); | ||
@example | ||
``` | ||
import {randomSuperhero} from 'superheroes'; | ||
superheroes.random(); | ||
//=> 'Spider-Ham' | ||
``` | ||
*/ | ||
random(): string; | ||
} | ||
|
||
export = superheroes; | ||
randomSuperhero(); | ||
//=> 'Spider-Ham' | ||
``` | ||
*/ | ||
export function randomSuperhero(): 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 superheroes = require('./superheroes.json'); | ||
import uniqueRandomArray from 'unique-random-array'; | ||
import superheroes from './superheroes.json' with {type: 'json'}; | ||
|
||
exports.all = superheroes; | ||
exports.random = uniqueRandomArray(superheroes); | ||
export default superheroes; | ||
|
||
export const randomSuperhero = uniqueRandomArray(superheroes); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) | ||
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
|
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 |
---|---|---|
|
@@ -4,16 +4,24 @@ | |
"description": "Get superhero names", | ||
"license": "MIT", | ||
"repository": "sindresorhus/superheroes", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "[email protected]", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=18.20" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
"//test": "xo && ava", | ||
"test": "ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
|
@@ -35,16 +43,10 @@ | |
"comics" | ||
], | ||
"dependencies": { | ||
"unique-random-array": "^2.0.0" | ||
"unique-random-array": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
}, | ||
"tsd": { | ||
"compilerOptions": { | ||
"resolveJsonModule": true | ||
} | ||
"ava": "^6.1.2", | ||
"xo": "^0.58.0" | ||
} | ||
} |
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 superheroes from '.'; | ||
import superheroes, {randomSuperhero} from './index.js'; | ||
|
||
test('main', t => { | ||
t.true(superheroes.all.length > 0); | ||
t.true(superheroes.all.includes('Superman')); | ||
t.truthy(superheroes.random()); | ||
t.true(superheroes.length > 0); | ||
t.true(superheroes.includes('Superman')); | ||
t.truthy(randomSuperhero()); | ||
}); |