Version: 1.0.9

API Quick Reference

Quick Peek

NameArgumentsDefaultReturnsDescription
getPrefixnonenonestringGets the prefix part of the full name, if any
getFirstnamenonenonestringGets 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
getInitialsorderedBy, withMidnull, falsestringGets the initials of the first and last name
describewhatfullnameSummaryGives some descriptive statistics of the characters' distribution.
shortenorderedBynullstringReturns a typical name (e.g. first and last name)
compresslimit, by20, middlenamestringCompresses a name by using different forms of variants
usernamenonenonestring[]Suggests possible (randomly) usernames closest to the name
formathownullstringFormats the name as desired
zipbynullstringShortens a full name

Aliases

Some methods are also accessible via aliases:

MethodsAliases
getPrefixpx
getSuffixsx
getFirstnamefn
getLastnameln
getMiddlenamesmn
getFullnamefull
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