$ npm install randopeep
Originally I made this for generating fake NPCs for RPGs & fake accounts for things online.
All parameters are optional.
n
parameters is how many you would like, leave blank for 1.
randopeep.name(params, n)
- a person's name, params
are explained belowrandopeep.job(n)
- a job a person might dorandopeep.invention(n)
- a seemingly awesome-sounding inventionparams
A lot of different types of names can be generated. All parameters are optional, here are the defaults:
{
'origin' : random - 'chinese', 'elven/dark', 'dwarven','elven', 'english', 'germanic','japanese','orcish','spanish','netrunner',
'gender': random - 'male','female',
'last': true,
'justLast': false,
'prefix': random - true, false,
'returnData': false,
}
origin
- the place/time the names come fromgender
- male/female, if names are genderedlast
- get a lastname?justLast
- get lastname only?prefix
- look up gendered prefix, if applicablereturnData
- return options (as generated) with name
field, good if you want random gender/origin, but want to know about it afterIf you set any of them to an array, it will pick a random element.
randopeep.address.state(n)
- a US staterandopeep.address.state.a(n)
- an abbreviated US staterandopeep.address.zip(n)
- a zipcoderandopeep.address.city(n)
- a pretend cityrandopeep.address.geo(n)
- a geolocationrandopeep.address.streetName(n)
- a streetNamerandopeep.address.streetAddress(useFullAddress, n)
- a street address, set useFullAddress to get secondary addressrandopeep.address.phone(n)
- a phone numberrandopeep.address.uk.country(n)
- a country in the UKrandopeep.address.uk.county(n)
- a county in the UKrandopeep.cc(type, charCount, n)
- a credit-card, type
is "visa", "mastercard", "amex", or "discover". charCount
should be 13 or 16randopeep.corporate.name(type, n)
- a corporate name, type
is explained belowrandopeep.corporate.catchPhrase(n)
- n
corporate catchphrasesrandopeep.corporate.bs(n)
- n
lines of corporate BStype
It can be one of these:
cyber
- a company from the retrofuturefirm
- a law-firm, all last names are random non-fantasy, but from the same originsmall
- a small companylarge
- a large corprandopeep.internet.ip(n)
- an IP addressrandopeep.internet.domain(derived, n)
- a internet domainname, derived
is explained, belowrandopeep.internet.email(derived, n)
- an email address, derived
is explained, belowrandopeep.internet.username(derived, n)
- an internet username, derived
is explained, belowderived
Will attempt to use the text that you give it as a base for generating other things. Makes more-legit looking email, if you already know the name, for example.
randopeep.ipsum(n, list)
- n
words from ipsum list
, default list is "lorem" and default count is 200randopeep.clickbait.headline(star, n)
- a clickbait headline, star
is the optional name of a star for the headline to be aboutrandopeep.clickbait.star(n)
- a star from a headlinerandopeep.data
- the raw data, keyed by list namerandopeep.get(list, n)
- n
items from list
See unit-tests in test/test.js if you need more details.
Install: npm install randopeep
in your code:
const randopeep = require('randopeep')
const myFakeName = randopeep.name()
Just include randopeep.js
in your thing, and use it like normal:
<script src="http://konsumer.js.org/randopeep/randopeep.js"></script>
<script>
document.body.innerHTML = "I'm cool dude named " + randopeep.name({gender:'male'})
</script>
There is also support for AMD/require.js, just put out/randopeep.js in your application dir, and do this:
define(['randopeep'], function(randopeep){
document.body.innerHTML = "I'm cool lady named " + randopeep.name({gender:'female'})
})
You can add your own, if you install dev-tools with npm install
then add whatever you want to data/ dir, and run npm run build
.
Format is 1 item per line.
Let's pretend some of the built-in wordlist libraries don't have the randopeep.name()
convenience function, and load the libraries, directly:
const myLeetName = randopeep.get('name/english/female/first') + ' ' + randopeep.get('name/netrunner/first')
or even use formatting to make the code a bit neater:
const myLeetName = randopeep.format('{0} {1}',
randopeep.get('name/chinese/male/first'),
randopeep.get('name/netrunner/first')
)
You can run my CLI tests with npm test
or open test/index.html to run same tests, in-browser.
© 2010 - cnpmjs.org x YWFE | Home | YWFE