Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kraihn committed Jan 14, 2015
0 parents commit 2c9b0d1
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Jared Dickson <[email protected]> (jareddickson.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:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# dragon-names

> Get awesome dragon names
The name lists are just JSON files and can be used wherever.


## Install

```
$ npm install --save dragon-names
```


## Usage

```js
var dragonNames = require('dragon-names');

dragonNames.literatureRandom();
//=> Smaug
```


## API

### .animated

Type: `array`

Top animated dragon names.

### .comic

Type: `array`

Top comic dragon names.

### .film

Type: `array`

Top film dragon names.

### .game

Type: `array`

Top game dragon names.

### .literature

Type: `array`

Top literature dragon names.

### .television

Type: `array`

Top television dragon names.

### .all

Type: `array`

Top dragon names.

### .animatedRandom()

Type: `function`

Random animated dragon name.

### .comicRandom()

Type: `function`

Random comic dragon name.

### .filmRandom()

Type: `function`

Random film dragon name.

### .gameRandom()

Type: `function`

Random game dragon name.

### .literatureRandom()

Type: `function`

Random literature dragon name.

### .televisionRandom()

Type: `function`

Random television dragon name.

### .allRandom()

Type: `function`

Random dragon name.


## CLI

```
$ npm install --global dragon-names
```

```
$ dragon-names --help
Examples
$ dragon-names
Smaug
$ dragon-names --all --type game
Alduin
Spyro
...
Options
--all Get all names instead of a random name
--type Type of name: animated|comic|film|game|literature|television|all Default: all
```


## Inspired By [Sindre Sorhus](https://sindresorhus.com)

- [`cat-names`](https://github.com/sindresorhus/cat-names) - Get popular cat names
- [`dog-names`](https://github.com/sindresorhus/dog-names) - Get popular dog names


## License

MIT © [Jared Dickson](https://jareddickson.com)
24 changes: 24 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node
'use strict';
var meow = require('meow'),
dragonNames = require('./index.js');

var cli = meow({
help: [
'Examples',
' $ dragon-names',
' Smaug',
'',
' $ dog-names --all --type game',
' Alduin',
' Spyro',
' ...',
'',
'Options',
' --all Get all names instead of a random name',
' --type Type of name: animated|comic|film|game|literature|television|all Default: all'
].join('\n')
});

var type = cli.flags.type || 'all';
console.log(cli.flags.all ? dragonNames[type].join('\n') : dragonNames[type + 'Random']());
14 changes: 14 additions & 0 deletions data/animated-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
"Devon & Cornwall",
"Dragon",
"Elliott",
"Maleficent",
"Mushu",
"Spike",
"Predaking",
"Tabaluga",
"Tiamat",
"Toothless",
"Trogdor",
"Stormfly"
]
11 changes: 11 additions & 0 deletions data/comic-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
"Cordelia",
"Dragon Man",
"Dragon of the Moon",
"Dulcy",
"Fafnir",
"Fin Fang Foom",
"Lockheed",
"Porunga",
"Shenron"
]
19 changes: 19 additions & 0 deletions data/film-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
"Buraki",
"Bio Dragon",
"Draco",
"Dagahra",
"Desghidorah",
"Falkor",
"Golden Dragon",
"Grandeeney",
"Grand King Ghidorah",
"Igneel",
"Metalicana",
"King Ghidorah",
"Monster X/Kaiser Ghidorah",
"Haku",
"Vermithrax Pejorative",
"Unnamed",
"Whimsey Weatherbe"
]
25 changes: 25 additions & 0 deletions data/game-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
"Alduin",
"Alexstraza, The Life Binder",
"Archdemons",
"Bahamut",
"Darby",
"Dracolich",
"Draigoch",
"Deathwing",
"Ender Dragon",
"Enywas",
"Feyrbrand",
"Grigori",
"Grima",
"Naga",
"Onaga",
"Paarthurnax",
"Ridley",
"Necrosan",
"Seath the Scaleless",
"Spyro",
"Synn",
"Ur Dragon",
"Volvagia"
]
29 changes: 29 additions & 0 deletions data/literature-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
"Ancalagon the Black",
"Chrysophylax Dives",
"Dagurashibanipal",
"Dragon",
"Drogon",
"Errol",
"Faranth",
"Fírnen",
"Glaedr",
"Glaurung",
"Hasai",
"Icefyre",
"Katla",
"Montague Bunsen-Burner",
"Mnementh",
"Moon",
"Norberta",
"Ramoth",
"Rhaegal",
"Ruth",
"Saphira",
"Smaug",
"Temeraire",
"Thorn",
"Tintaglia",
"Unnamed",
"Viserion"
]
14 changes: 14 additions & 0 deletions data/television-dragon-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
"Aithusa",
"Drogon",
"Kilgharrah",
"Melba",
"Mizunoeryu",
"Pyre",
"Narse",
"Natsunomeryu",
"Rhaegal",
"Scorch",
"Tamba",
"Viserion"
]
76 changes: 76 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
'use strict';
var uniqueRandom = require('unique-random'),
animatedDragonNames = require('./data/animated-dragon-names.json'),
comicDragonNames = require('./data/comic-dragon-names.json'),
filmDragonNames = require('./data/film-dragon-names.json'),
gameDragonNames = require('./data/game-dragon-names.json'),
literatureDragonNames = require('./data/literature-dragon-names.json'),
televisionDragonNames = require('./data/television-dragon-names.json');
var allDragonNames = [];

animatedDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

comicDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

filmDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

gameDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

literatureDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

televisionDragonNames.forEach(function (name) {
allDragonNames.push(name);
});

var animatedRandom = uniqueRandom(0, animatedDragonNames.length - 1);
var comicRandom = uniqueRandom(0, comicDragonNames.length - 1);
var filmRandom = uniqueRandom(0, filmDragonNames.length - 1);
var gameRandom = uniqueRandom(0, gameDragonNames.length - 1);
var literatureRandom = uniqueRandom(0, literatureDragonNames.length - 1);
var televisionRandom = uniqueRandom(0, televisionDragonNames.length - 1);
var allRandom = uniqueRandom(0, allDragonNames.length - 1);

exports.animated = animatedDragonNames;
exports.comic = comicDragonNames;
exports.film = filmDragonNames;
exports.game = gameDragonNames;
exports.literature = literatureDragonNames;
exports.television = televisionDragonNames;

exports.animatedRandom = function () {
return animatedDragonNames[animatedRandom()];
};

exports.comicRandom = function () {
return comicDragonNames[comicRandom()];
};

exports.filmRandom = function () {
return filmDragonNames[filmRandom()];
};

exports.gameRandom = function () {
return gameDragonNames[gameRandom()];
};

exports.literatureRandom = function () {
return literatureDragonNames[literatureRandom()];
};

exports.televisionRandom = function () {
return televisionDragonNames[televisionRandom()];
};

exports.allRandom = function () {
return allDragonNames[allRandom()];
};
Loading

0 comments on commit 2c9b0d1

Please sign in to comment.