location Domain
The location domain maps domain keywords to underlying faker implementations.
Faker Documentation
Methods
language.alpha2
Returns a random ISO 639-1 language code.
- Canonical:
awd.domain.location.language.alpha2 - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.language.alpha2 call.
language.alpha2
Returns: pa
language.alpha3
Returns a random ISO 639-2 or ISO 639-3 language code.
- Canonical:
awd.domain.location.language.alpha3 - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.language.alpha3 call.
language.alpha3
Returns: pan
language.name
Returns a random spoken language name.
- Canonical:
awd.domain.location.language.name - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.language.name call.
language.name
Returns: Punjabi
location.buildingNumber
Generates a random building number.
- Canonical:
awd.domain.location.buildingNumber - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.buildingNumber call.
location.buildingNumber
Returns: 7031
location.cardinalDirection
Returns a random cardinal direction (north, east, south, west).
- Canonical:
awd.domain.location.cardinalDirection - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
abbreviated | boolean | no | If true this will return abbreviated cardinal directions (N, E, S, W). Otherwise this will return the long name. |
Examples:
Shows location.cardinalDirection when optional params are omitted.
location.cardinalDirection()
Returns: East
Shows location.cardinalDirection using abbreviated.
location.cardinalDirection(abbreviated=true)
Returns: E
location.city
Generates a random localized city name.
- Canonical:
awd.domain.location.city - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.city call.
location.city
Returns: Edwinville
location.continent
Returns a random continent name.
- Canonical:
awd.domain.location.continent - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.continent call.
location.continent
Returns: Asia
location.country
Returns a random country name.
- Canonical:
awd.domain.location.country - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.country call.
location.country
Returns: India
location.countryCode
Returns a random ISO_3166-1 country code.
- Canonical:
awd.domain.location.countryCode - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
variant | alpha-2|alpha-3|numeric | no | The code to return. Can be either 'alpha-2' (two-letter code), 'alpha-3' (three-letter code) or 'numeric' (numeric code). |
Examples:
Shows location.countryCode when optional params are omitted.
location.countryCode()
Returns: IM
Shows location.countryCode using variant.
location.countryCode(variant="alpha-3")
Returns: IMN
location.county
Returns a random localized county, or other equivalent second-level administrative entity for the locale's country such as a district or department.
- Canonical:
awd.domain.location.county - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.county call.
location.county
Returns: Cleveland
location.direction
Returns a random direction (cardinal and ordinal; northwest, east, etc).
- Canonical:
awd.domain.location.direction - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
abbreviated | boolean | no | If true this will return abbreviated directions (NW, E, etc). Otherwise this will return the long name. |
Examples:
Shows location.direction when optional params are omitted.
location.direction()
Returns: West
Shows location.direction using abbreviated.
location.direction(abbreviated=true)
Returns: W
location.latitude
Generates a random latitude.
- Canonical:
awd.domain.location.latitude - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
min | number | no | The lower bound for the latitude to generate. |
max | number | no | The upper bound for the latitude to generate. |
precision | number | no | The number of decimal points of precision for the latitude. |
Examples:
Shows location.latitude when optional params are omitted.
location.latitude()
Returns: -14.936
Shows location.latitude using min.
location.latitude(max=10, min=1)
Returns: 4.7532
Shows location.latitude using max.
location.latitude(max=5)
Returns: -50.3829
Shows location.latitude using precision.
location.latitude(precision=1)
Returns: -14.9
location.longitude
Generates a random longitude.
- Canonical:
awd.domain.location.longitude - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
min | number | no | The lower bound for the longitude to generate. |
max | number | no | The upper bound for the longitude to generate. |
precision | number | no | The number of decimal points of precision for the longitude. |
Examples:
Shows location.longitude when optional params are omitted.
location.longitude()
Returns: -29.8721
Shows location.longitude using min.
location.longitude(max=10, min=1)
Returns: 4.7532
Shows location.longitude using max.
location.longitude(max=5)
Returns: -102.8509
Shows location.longitude using precision.
location.longitude(precision=1)
Returns: -29.9
location.ordinalDirection
Returns a random ordinal direction (northwest, southeast, etc).
- Canonical:
awd.domain.location.ordinalDirection - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
abbreviated | boolean | no | If true this will return abbreviated ordinal directions (NW, SE, etc). Otherwise this will return the long name. |
Examples:
Shows location.ordinalDirection when optional params are omitted.
location.ordinalDirection()
Returns: Northwest
Shows location.ordinalDirection using abbreviated.
location.ordinalDirection(abbreviated=true)
Returns: NW
location.secondaryAddress
Generates a random localized secondary address. This refers to a specific location at a given address
- Canonical:
awd.domain.location.secondaryAddress - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.secondaryAddress call.
location.secondaryAddress
Returns: Apt. 703
location.state
Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.
- Canonical:
awd.domain.location.state - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
abbreviated | boolean | no | If true this will return abbreviated first-level administrative entity names. Otherwise this will return the long name. |
Examples:
Shows location.state when optional params are omitted.
location.state()
Returns: Massachusetts
Shows location.state using abbreviated.
location.state(abbreviated=true)
Returns: MA
location.street
Generates a random localized street name.
- Canonical:
awd.domain.location.street - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.street call.
location.street
Returns: Gutmann Creek
location.streetAddress
Generates a random localized street address.
- Canonical:
awd.domain.location.streetAddress - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
useFullAddress | boolean | no | Whether to expand to a full address including secondary address information. |
Examples:
Shows location.streetAddress when optional params are omitted.
location.streetAddress()
Returns: 7031 Iris Mill
Shows location.streetAddress using useFullAddress.
location.streetAddress(useFullAddress=true)
Returns: 7031 Iris Mill Apt. 728
location.timeZone
Returns a random IANA time zone name.
- Canonical:
awd.domain.location.timeZone - Faker docs: https://fakerjs.dev/api/location
No parameters.
Examples:
Shows the default location.timeZone call.
location.timeZone
Returns: America/Santiago
location.zipCode
Generates data using faker location zip code.
- Canonical:
awd.domain.location.zipCode - Faker docs: https://fakerjs.dev/api/location
| Arg | Type | Required | Description |
|---|---|---|---|
state | string | no | State abbreviation used to constrain the generated zip code where supported by the locale. |
format | string | no | Format pattern used for the generated zip code. |
Examples:
Shows the default location.zipCode call.
location.zipCode()
Returns: 70310
Shows location.zipCode using a format option.
location.zipCode(format="#####")
Returns: 47031