Skip to main content

address

zipCode​

Description​

Method that generate random zipcode from format. If format is not specified, the locale's zip format is used.

Parameters​

NameTypeDescription
format<String>What format to use when generate zipCode. Default value is locale format

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.zipCode());
    1. result
    '93001'
  2. Describing that i want an zip code using ###-##.### as template

    1. code
    console.log(pure.address.zipCode('###-##.###'));
    1. 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​

NameTypeDescription
state<String>State used to format zipCode. Default is random zipCode from locale

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.zipCodeByState());
    1. result
    '70563'
  2. Describing that i want an zip code from California, USA

    1. code
    pure.setLocale('en_US');
    console.log(pure.address.zipCodeByState('CA'));
    1. 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​

NameTypeDescription
state<String>You can filter by state name. Default value is random

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.city());
    1. result
    'San Rafael'
  2. Describing that i want an city from 'Alabama'

    1. code
    console.log(pure.address.city('Alabama'));
    1. result
    'Tuscumbia'

cityPrefix​

Description​

Method that generate random localized city prefix

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.cityPrefix());
    1. result
    'Port'

citySuffix​

Description​

Method that generate random localized city suffix

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.citySuffix());
    1. result
    'chester'

cityName​

Description​

Method that generate random localized city name

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    pure.setLocale('pt_PT');
    console.log(pure.address.cityName());
    1. result
    'Leiria'

streetName​

Description​

Method that generate random street name

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.streetName());
    1. result
    'Botsford Mills'

streetAddress​

Description​

Method that generate random localized street address

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.streetAddress());
    1. result
    '45282 Metz Streets'

streetSuffix​

Description​

Method that generate random localized street suffix

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.streetSuffix());
    1. result
    'Overpass'

streetPrefix​

Description​

Method that generate random localized street prefix

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    pure.setLocale('pt_PT');
    console.log(pure.address.streetPrefix());
    1. result
    'Acesso'

secondaryAddress​

Description​

Method that generate random secondary address

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.secondaryAddress());
    1. result
    'Apt. 110'

county​

Description​

Method that generate random localized county

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.county());
    1. result
    'Bedfordshire'

country​

Description​

Method that generate random localized country

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.country());
    1. result
    'Philippines'

defaultCountry​

Description​

Method that generate random localized default country

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.defaultCountry());
    1. result
    'United States of America'

countryCode​

Description​

Method that generate random localized country code

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.countryCode());
    1. result
    'GN'

state​

Description​

Method that generate random localized state

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.state());
    1. result
    'South Dakota'

stateAbbr​

Description​

Method that generate random localized state abbreviation

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.stateAbbr());
    1. result
    'SD'

latitude​

Description​

Method that generate random latitude respecting parameters

Parameters​

NameTypeDescription
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​

  1. Without passing parameters

    1. code
    console.log(pure.address.latitude());
    1. result
    '16.3386'
  2. Describing that i want an latitude between -8 and 10 with 4 floating point precision

    1. code
    console.log(pure.address.latitude({ min: -8, max: 10, precision: 4 }));
    1. result
    '9.2941'

longitude​

Description​

Method that generate random longitude respecting parameters

Parameters​

NameTypeDescription
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​

  1. Without passing parameters

    1. code
    console.log(pure.address.longitude());
    1. result
    '154.4644'
  2. Describing that i want an longitude between -100 and 90 with 4 floating point precision

    1. code
    console.log(pure.address.longitude({ min: -100, max: 90, precision: 4 }));
    1. result
    '-59.8514'

direction​

Description​

Method that generate random direction

Parameters​

NameTypeDescription
useAbbr<Boolean>Use or not abbreviation when generating direction. Default value is false

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.direction());
    1. result
    'Southeast'
  2. Describing that i want an direction abbreviated

    1. code
    console.log(pure.address.direction(true));
    1. result
    'NW'

cardinalDirection​

Description​

Method that generate random cardinal direction

Parameters​

NameTypeDescription
useAbbr<Boolean>Use or not abbreviation when generating direction. Default value is false

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.cardinalDirection());
    1. result
    'East'
  2. Describing that i want an cardinal direction abbreviated

    1. code
    console.log(pure.address.cardinalDirection(true));
    1. result
    'N'

ordinalDirection​

Description​

Method that generate random ordinal direction

Parameters​

NameTypeDescription
useAbbr<Boolean>Use or not abbreviation when generating direction. Default value is false

Returns​

  • <String>

Usage​

  1. Without passing parameters

    1. code
    console.log(pure.address.ordinalDirection());
    1. result
    'Northwest'
  2. Describing that i want an ordinal direction abbreviated

    1. code
    console.log(pure.address.ordinalDirection(true));
    1. result
    'SE'

nearbyGPSCoordinate​

Description​

Method that generate random nearby GPS coordinate respecting parameters

Parameters​

NameTypeDescription
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​

  1. Without passing parameters

    1. code
    console.log(pure.address.nearbyGPSCoordinate());
    1. result
    [ '12.2727', '-22.5733' ]
  2. Describing that i want an nearby coordinate using -23.561414 as latitude and -46.6558819 as longitude with 4 as distance

    1. code
    console.log(pure.address.nearbyGPSCoordinate({ coordinate: [ '-23.561414', '-46.6558819' ], radius: 4, isMetric: true }));
    1. result
    [ '-23.5969', '-46.6619' ]

timeZone​

Description​

Method that generate random time zone

Parameters​

NameTypeDescription
N/AN/AThis method doesn't receive any parameters

Returns​

  • <String>

Usage​

  1. Without passing parameters
    1. code
    console.log(pure.address.timeZone());
    1. result
    'Pacific/Auckland'