Interface Address

Generator to generate addresses and locations.

interface Address {
    address(): Record<string, unknown>;
    city(): string;
    country(): string;
    countryAbbreviation(): string;
    latitude(): number;
    latitudeRange(min: number, max: number): number;
    longitude(): number;
    longitudeRange(min: number, max: number): number;
    state(): string;
    stateAbbreviation(): string;
    street(): string;
    streetName(): string;
    streetNumber(): string;
    streetPrefix(): string;
    streetSuffix(): string;
    zip(): string;
}

Methods

  • Residential location including street, city, state, country and postal code.

    Returns Record<string, unknown>

    a random address

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.address())
    }

    Output (formatted as JSON value)

    {"Address":"53883 Villageborough, San Bernardino, Kentucky 56992","Street":"53883 Villageborough","City":"San Bernardino","State":"Kentucky","Zip":"56992","Country":"United States of America","Latitude":11.29359,"Longitude":-145.577493}
    
  • Part of a country with significant population, often a central hub for culture and commerce.

    Returns string

    a random city

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.city())
    }

    Output (formatted as JSON value)

    "Hialeah"
    
  • Nation with its own government and defined territory.

    Returns string

    a random country

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.country())
    }

    Output (formatted as JSON value)

    "Togo"
    
  • Shortened 2-letter form of a country's name.

    Returns string

    a random country abbreviation

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.countryAbbreviation())
    }

    Output (formatted as JSON value)

    "TG"
    
  • Geographic coordinate specifying north-south position on Earth's surface.

    Returns number

    a random latitude

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.latitude())
    }

    Output (formatted as JSON value)

    11.394086
    
  • Latitude number between the given range (default min=0, max=90).

    Parameters

    • min: number

      Min

    • max: number

      Max

    Returns number

    a random latitude range

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.latitudeRange(0,90))
    }

    Output (formatted as JSON value)

    50.697043
    
  • Geographic coordinate indicating east-west position on Earth's surface.

    Returns number

    a random longitude

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.longitude())
    }

    Output (formatted as JSON value)

    22.788172
    
  • Longitude number between the given range (default min=0, max=180).

    Parameters

    • min: number

      Min

    • max: number

      Max

    Returns number

    a random longitude range

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.longitudeRange(0,180))
    }

    Output (formatted as JSON value)

    101.394086
    
  • Governmental division within a country, often having its own laws and government.

    Returns string

    a random state

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.state())
    }

    Output (formatted as JSON value)

    "Massachusetts"
    
  • Shortened 2-letter form of a country's state.

    Returns string

    a random state abbreviation

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.stateAbbreviation())
    }

    Output (formatted as JSON value)

    "AA"
    
  • Public road in a city or town, typically with houses and buildings on each side.

    Returns string

    a random street

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.street())
    }

    Output (formatted as JSON value)

    "53883 Villageborough"
    
  • Name given to a specific road or street.

    Returns string

    a random street name

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.streetName())
    }

    Output (formatted as JSON value)

    "Fall"
    
  • Numerical identifier assigned to a street.

    Returns string

    a random street number

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.streetNumber())
    }

    Output (formatted as JSON value)

    "25388"
    
  • Directional or descriptive term preceding a street name, like 'East' or 'Main'.

    Returns string

    a random street prefix

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.streetPrefix())
    }

    Output (formatted as JSON value)

    "West"
    
  • Designation at the end of a street name indicating type, like 'Avenue' or 'Street'.

    Returns string

    a random street suffix

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.streetSuffix())
    }

    Output (formatted as JSON value)

    "ville"
    
  • Numerical code for postal address sorting, specific to a geographic area.

    Returns string

    a random zip

    import { Faker } from "k6/x/faker"

    let faker = new Faker(11)

    export default function () {
    console.log(faker.address.zip())
    }

    Output (formatted as JSON value)

    "25388"