MCPcopy
hub / github.com/faker-js/faker / streetAddress

Method streetAddress

src/modules/location/index.ts:344–365  ·  view source on GitHub ↗

* Generates a random localized street address. * * @param options Whether to use a full address or an options object. * @param options.useFullAddress When true this will generate a full address. * Otherwise it will just generate a street address. * * @example * faker.location.st

(
    options:
      | boolean
      | {
          /**
           * When true this will generate a full address.
           * Otherwise it will just generate a street address.
           */
          useFullAddress?: boolean;
        } = {}
  )

Source from the content-addressed store, hash-verified

342 * @since 8.0.0
343 */
344 streetAddress(
345 options:
346 | boolean
347 | {
348 /**
349 * When true this will generate a full address.
350 * Otherwise it will just generate a street address.
351 */
352 useFullAddress?: boolean;
353 } = {}
354 ): string {
355 if (typeof options === 'boolean') {
356 options = { useFullAddress: options };
357 }
358
359 const { useFullAddress } = options;
360
361 const formats = this.faker.definitions.location.street_address;
362 const format = formats[useFullAddress ? 'full' : 'normal'];
363
364 return this.faker.helpers.fake(format);
365 }
366
367 /**
368 * Generates a random localized full postal address, which may include a street address, secondary address, city, state, and zip code. To ensure you get locale-specific address formats, use a localized Faker instance.

Callers

nothing calls this directly

Calls 1

fakeMethod · 0.80

Tested by

no test coverage detected