nerdata
Testdata from scifi and fantasy, because y'all need it.
CONTRIBUTING
I don't have a system in place yet for managing pull requests -- shoot me a message at daniel.rigberg@gmail.com, and let's talk!
INITIALIZATION
const Nerdata = require("nerdata");
A new instance can be specified with all universes:
const nerdata = new Nerdata();
To limit memory usage, you can limit in two ways:
const nerdata = new Nerdata({
include: ["dune", "star-wars"],
});
const nerdata = new Nerdata({
exclude: ["rick-and-morty"],
});
USAGE
Call signature: nerdata.namespace.method([universes], [options])
Each method will return a random item from all loaded universes if no arguments are given. Universes can be filtered by providing a string or array of strings. Requesting a universe that does not exist or has not been loaded will throw an error.
Options may be provided for certain methods as an object.
nerdata.name.full();
nerdata.name.full("star-wars");
nerdata.name.full(["dune", "star-wars"]);
nerdata.name.full("fifty-shades-of-grey");
API
All return values are strings.
method | description | examples |
---|
name.first | first name | "Han", "Rick", "Paul" |
name.last | last name | "Solo", "Sanchez", "Atreides" |
name.full | full name | "Han Solo", "Rick Sanchez", "Paul Atreides" |
place.any | name of location (any type) | "Ahto City", "Gazorpazorp", "Caladan" |
place.city | name of city | "Ahto City", "Seattle", "Bandalong" |
place.planet | name of planet | "Tattooine", "Gazorpazorp", "Caladan" |
item.any | name of item (any type) | "light saber", "space cruiser", "suspensor" |
item.tool | name of tool | "neural band", "plumbus", "suspensor" |
item.weapon | name of weapon | "light saber", "freeze ray", "crysknife" |
item.vehicle | name of vehicle | "X-Wing", "space cruiser", "ornithopter" |
species.any | name of species (any type) | "jawa", "splorpian", "sandworm" |
species.sentient | name of sentient species | "jawa", "human", "tleilaxu" |
species.nonsentient | name of nonsentient species | "bantha", "fleeb", "sandworm" |
quote.sentence | full sentence with punctuation | "There is no try: only do." |
quote.paragraph | multiple sentences with punctuation | "There is no try: only do. You pass butter. " |
OPTIONS
quote.sentence: opts.citation
citation
: if true, appends speaker to quote
- true:
"It's a trap!" - Admiral Ackbar
- false:
It's a trap!
nerdata.quote.sentence('rick-and-morty', { citation: true})
nerdata.quote.sentence('rick-and-morty', { citation: false})
nerdata.quote.sentence('rick-and-morty')
quote.paragraph: opts.sentences
sentences
: number of sentences in paragraph
nerdata.quote.paragraph('rick-and-morty', { sentences: 1})
nerdata.quote.paragraph('rick-and-morty')