Version: 1.1.0

API Quick Reference

Quick Peek

MethodsArgumentsDefaultReturnsDescription
getPrefixnonenonestringGets the prefix part of the full name, if any
getFirstnameincludeAlltruestringGets the first name part of the full name
getMiddlenamesnonenonestring[]Gets the middle name part of the full name, if any
getLastnameformatnullstringGets the last name part of the full name
getSuffixnonenonestringGets the suffix part of the full name, if any
getFullnameorderedBynullstringGets the full name
getBirthnameorderedBynullstringGets the birth name, no prefix or suffix
getInitialsorderedBy, withMidnull, falsestringGets the initials of the first and last names
describenameTypenullSummaryGives some descriptive statistics of the characters' distribution
shortenorderedBynullstringReturns a typical name (e.g. first and last name)
compresslimit, by, warning20, middlename, truestringCompresses a name using different forms of variants
usernamenonenonestring[]Suggests possible (randomly) usernames closest to the name
formathownullstringFormats the name as desired
zipbymiddlenamestringShortens a full name
sizenonenonenumberReturns the count of characters of the birth name, excluding punctuations
asciioptions{}number[]Returns an ascii representation of each characters
tocasenonestringTransforms a birth name to a specific title case
passwdnameTypenullstringReturns a password-like representation of a name

Aliases

Some methods are also accessible via aliases:

MethodsAliases
getPrefixpx
getFirstnamefn
getMiddlenamesmn
getLastnameln
getSuffixsx
getFullnamefull
getBirthnamebirth
getInitialsinits
describestats

Example:

import { Namefully } from 'namefully'
const name = new Namefully('Angela Merkel')
// Retrieve the last name part
console.log(name.getLastname()) // => Merkel
// or using an alias
console.log(name.ln()) // => Merkel