superheroes
Advanced tools
+21
-25
@@ -1,31 +0,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; |
+5
-5
@@ -1,6 +0,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); |
+15
-13
| { | ||
| "name": "superheroes", | ||
| "version": "3.0.0", | ||
| "version": "4.0.0", | ||
| "description": "Get superhero names", | ||
| "license": "MIT", | ||
| "repository": "sindresorhus/superheroes", | ||
| "funding": "https://github.com/sponsors/sindresorhus", | ||
| "author": { | ||
| "name": "Sindre Sorhus", | ||
| "email": "sindresorhus@gmail.com", | ||
| "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" | ||
| }, | ||
@@ -38,14 +46,8 @@ "files": [ | ||
| "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" | ||
| } | ||
| } |
+15
-18
@@ -1,2 +0,2 @@ | ||
| # superheroes [](https://travis-ci.org/sindresorhus/superheroes) | ||
| # superheroes | ||
@@ -9,26 +9,22 @@ > Get superhero names | ||
| **I'm not accepting additional entries to the list.** | ||
| ## Install | ||
| ```sh | ||
| npm install superheroes | ||
| ``` | ||
| $ npm install superheroes | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| const superheroes = require('superheroes'); | ||
| import superheroes from 'superheroes'; | ||
| superheroes.all; | ||
| superheroes; | ||
| //=> ['3-D Man', 'A-Bomb', …] | ||
| superheroes.random(); | ||
| //=> 'Spider-Ham' | ||
| ``` | ||
| ## API | ||
| ### .all | ||
| ### superheroes | ||
@@ -39,9 +35,15 @@ Type: `string[]` | ||
| ### .random() | ||
| ### randomSuperhero() | ||
| Type: `Function` | ||
| Random superhero name. | ||
| Get a random superhero name. | ||
| ```js | ||
| import {randomSuperhero} from 'superheroes'; | ||
| randomSuperhero(); | ||
| //=> 'Spider-Ham' | ||
| ``` | ||
| ## Related | ||
@@ -56,6 +58,1 @@ | ||
| - [yes-no-words](https://github.com/sindresorhus/yes-no-words) - Get yes/no like words | ||
| ## License | ||
| MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
2
-33.33%Yes
NaN28913
-0.14%1852
-0.22%56
-5.08%+ Added
+ Added
- Removed
- Removed
Updated