address
zipCode​
Description​
Method that generate random zipcode from format. If format is not specified, the locale's zip format is used.
Parameters​
Name | Type | Description |
---|---|---|
format | <String> | What format to use when generate zipCode. Default value is locale format |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.zipCode());
- result
'93001'
Describing that i want an zip code using
###-##.###
as template- code
console.log(pure.address.zipCode('###-##.###'));
- result
'868-80.346'
zipCodeByState​
Description​
Method that generates random zipcode from state abbreviation. If state abbreviation is not specified, a random zip code is generated according to the locale's zip format. Only works for locales with postcode_by_state definition. If a locale does not have a postcode_by_state definition, a random zip code is generated according to the locale's zip format.
Parameters​
Name | Type | Description |
---|---|---|
state | <String> | State used to format zipCode. Default is random zipCode from locale |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.zipCodeByState());
- result
'70563'
Describing that i want an zip code from California, USA
- code
pure.setLocale('en_US');
console.log(pure.address.zipCodeByState('CA'));- result
'91357'
city​
Description​
Method that generates a random city name based on locale definitions. If the locale you selected has a list separated by state, you can filter the result by passing what state you want as parameter.
Parameters​
Name | Type | Description |
---|---|---|
state | <String> | You can filter by state name. Default value is random |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.city());
- result
'San Rafael'
Describing that i want an city from 'Alabama'
- code
console.log(pure.address.city('Alabama'));
- result
'Tuscumbia'
cityPrefix​
Description​
Method that generate random localized city prefix
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.cityPrefix());
- result
'Port'
citySuffix​
Description​
Method that generate random localized city suffix
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.citySuffix());
- result
'chester'
cityName​
Description​
Method that generate random localized city name
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
pure.setLocale('pt_PT');
console.log(pure.address.cityName());- result
'Leiria'
streetName​
Description​
Method that generate random street name
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.streetName());
- result
'Botsford Mills'
streetAddress​
Description​
Method that generate random localized street address
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.streetAddress());
- result
'45282 Metz Streets'
streetSuffix​
Description​
Method that generate random localized street suffix
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.streetSuffix());
- result
'Overpass'
streetPrefix​
Description​
Method that generate random localized street prefix
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
pure.setLocale('pt_PT');
console.log(pure.address.streetPrefix());- result
'Acesso'
secondaryAddress​
Description​
Method that generate random secondary address
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.secondaryAddress());
- result
'Apt. 110'
county​
Description​
Method that generate random localized county
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.county());
- result
'Bedfordshire'
country​
Description​
Method that generate random localized country
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.country());
- result
'Philippines'
defaultCountry​
Description​
Method that generate random localized default country
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.defaultCountry());
- result
'United States of America'
countryCode​
Description​
Method that generate random localized country code
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.countryCode());
- result
'GN'
state​
Description​
Method that generate random localized state
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.state());
- result
'South Dakota'
stateAbbr​
Description​
Method that generate random localized state abbreviation
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.stateAbbr());
- result
'SD'
latitude​
Description​
Method that generate random latitude respecting parameters
Parameters​
Name | Type | Description |
---|---|---|
options | <Object> | You can pass parameters as this object properties |
options.min | <Number> | Min number to be generated. Default value is -90 |
options.max | <Number> | Max number to be generated. Default value is 90 |
options.precision | <Number> | Floating point precision to be used, if value is 0 then no floating point is generated. Default value is 4 |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.latitude());
- result
'16.3386'
Describing that i want an latitude between
-8
and10
with4
floating point precision- code
console.log(pure.address.latitude({ min: -8, max: 10, precision: 4 }));
- result
'9.2941'
longitude​
Description​
Method that generate random longitude respecting parameters
Parameters​
Name | Type | Description |
---|---|---|
options | <Object> | You can pass parameters as this object properties |
options.min | <Number> | Min number to be generated. Default value is -180 |
options.max | <Number> | Max number to be generated. Default value is 180 |
options.precision | <Number> | Floating point precision to be used, if value is 0 then no floating point is generated. Default value is 4 |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.longitude());
- result
'154.4644'
Describing that i want an longitude between
-100
and90
with4
floating point precision- code
console.log(pure.address.longitude({ min: -100, max: 90, precision: 4 }));
- result
'-59.8514'
direction​
Description​
Method that generate random direction
Parameters​
Name | Type | Description |
---|---|---|
useAbbr | <Boolean> | Use or not abbreviation when generating direction. Default value is false |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.direction());
- result
'Southeast'
Describing that i want an direction abbreviated
- code
console.log(pure.address.direction(true));
- result
'NW'
cardinalDirection​
Description​
Method that generate random cardinal direction
Parameters​
Name | Type | Description |
---|---|---|
useAbbr | <Boolean> | Use or not abbreviation when generating direction. Default value is false |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.cardinalDirection());
- result
'East'
Describing that i want an cardinal direction abbreviated
- code
console.log(pure.address.cardinalDirection(true));
- result
'N'
ordinalDirection​
Description​
Method that generate random ordinal direction
Parameters​
Name | Type | Description |
---|---|---|
useAbbr | <Boolean> | Use or not abbreviation when generating direction. Default value is false |
Returns​
- <String>
Usage​
Without passing parameters
- code
console.log(pure.address.ordinalDirection());
- result
'Northwest'
Describing that i want an ordinal direction abbreviated
- code
console.log(pure.address.ordinalDirection(true));
- result
'SE'
nearbyGPSCoordinate​
Description​
Method that generate random nearby GPS coordinate respecting parameters
Parameters​
Name | Type | Description |
---|---|---|
options | <Object> | You can pass parameters as this object properties |
options.coordinate | <Array> | Array with latitude and longitude used as base. Default value is random |
options.radius | <Number> | Max distance in KM between base coordinate that can be generated. Default value is 10.0 |
options.isMetric | <Boolean> | Declare if radius passed is metric or imperial. Default value is false |
Returns​
- <Array>
Usage​
Without passing parameters
- code
console.log(pure.address.nearbyGPSCoordinate());
- result
[ '12.2727', '-22.5733' ]
Describing that i want an nearby coordinate using
-23.561414
as latitude and-46.6558819
as longitude with4
as distance- code
console.log(pure.address.nearbyGPSCoordinate({ coordinate: [ '-23.561414', '-46.6558819' ], radius: 4, isMetric: true }));
- result
[ '-23.5969', '-46.6619' ]
timeZone​
Description​
Method that generate random time zone
Parameters​
Name | Type | Description |
---|---|---|
N/A | N/A | This method doesn't receive any parameters |
Returns​
- <String>
Usage​
- Without passing parameters
- code
console.log(pure.address.timeZone());
- result
'Pacific/Auckland'