Returns a random cardinal direction (north, east, south, west).
Optional
options: { abbreviated?: boolean }The options to use.
Optional
abbreviated?: booleanIf true this will return abbreviated directions (N, E, etc). Otherwise this will return the long name.
Returns a random ISO_3166-1 country code.
Optional
options: The code to return or an options object.
Optional
variant?: "alpha-2" | "alpha-3" | "numeric"The code to return.
Can be either 'alpha-2'
(two-letter code),
'alpha-3'
(three-letter code)
or 'numeric'
(numeric code).
Returns a random direction (cardinal and ordinal; northwest, east, etc).
Optional
options: { abbreviated?: boolean }The options to use.
Optional
abbreviated?: booleanIf true this will return abbreviated directions (NW, E, etc). Otherwise this will return the long name.
Returns a random spoken language.
Generates a random latitude.
Optional
options: { max?: number; min?: number; precision?: number }An options object.
Optional
max?: numberThe upper bound for the latitude to generate.
Optional
min?: numberThe lower bound for the latitude to generate.
Optional
precision?: numberThe number of decimal points of precision for the latitude.
Generates a random longitude.
Optional
options: { max?: number; min?: number; precision?: number }An options object.
Optional
max?: numberThe upper bound for the longitude to generate.
Optional
min?: numberThe lower bound for the longitude to generate.
Optional
precision?: numberThe number of decimal points of precision for the longitude.
Generates a random GPS coordinate within the specified radius from the given coordinate.
Optional
options: {The options for generating a GPS coordinate.
Optional
isMetric?: booleanIf true
assume the radius to be in kilometers. If false
for miles.
Optional
origin?: [latitude: number, longitude: number]The original coordinate to get a new coordinate close to.
Optional
radius?: numberThe maximum distance from the given coordinate to the new coordinate.
Returns a random ordinal direction (northwest, southeast, etc).
Optional
options: { abbreviated?: boolean }Whether to use abbreviated or an options object.
Optional
abbreviated?: booleanIf true this will return abbreviated directions (NW, SE, etc). Otherwise this will return the long name.
Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.
Generally, these are the ISO 3166-2 subdivisions for a country.
If a locale doesn't correspond to one specific country, the method may return ISO 3166-2 subdivisions from one or more countries that uses that language. For example, the ar
locale includes subdivisions from Arabic-speaking countries, such as Tunisia, Algeria, Syria, Lebanon, etc.
For historical compatibility reasons, the default en
locale only includes states in the United States (identical to en_US
). However, you can use other English locales, such as en_IN
, en_GB
, and en_AU
, if needed.
Optional
options: { abbreviated?: boolean }An options object.
Optional
abbreviated?: booleanIf true this will return abbreviated first-level administrative entity names. Otherwise this will return the long name.
Generates a random localized street address.
Optional
options: boolean | { useFullAddress?: boolean }Whether to use a full address or an options object.
Optional
useFullAddress?: booleanWhen true this will generate a full address. Otherwise it will just generate a street address.
Returns a random IANA time zone relevant to this locale.
The returned time zone is tied to the current locale.
Generates random zip code from specified format. If format is not specified, the locale's zip format is used.
Optional
options: string | { format?: string; state?: string }The format used to generate the zip code or an options object.
Optional
format?: stringThe optional format used to generate the zip code.
This won't be used if the state option is specified.
Optional
state?: stringThe state to generate the zip code for.
If the current locale does not have a corresponding postcode_by_state
definition, an error is thrown.
Module to generate addresses and locations. Prior to Faker 8.0.0, this module was known as
faker.address
.Overview
For a typical street address for a locale, use
streetAddress()
,city()
,state()
), andzipCode()
. Most locales provide localized versions for a specific country.If you need latitude and longitude coordinates, use
latitude()
andlongitude()
, ornearbyGPSCoordinate()
for a latitude/longitude near a given location.For a random country, you can use
country()
orcountryCode()
.