Generate massive amounts of fake contextual data for testing and development purposes
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Generate location data including addresses, coordinates, and geographic information with locale-specific formatting and realistic geographic relationships.
Generate complete addresses with locale-appropriate formatting and realistic components.
/**
* Generate a street address
* @param options - Configuration options
* @returns Street address string
*/
streetAddress(options?: {
useFullAddress?: boolean;
}): string;
/**
* Generate a building number
* @returns Building number string
*/
buildingNumber(): string;
/**
* Generate a street name
* @returns Street name string
*/
street(): string;
/**
* Generate a secondary address (apartment, suite, etc.)
* @returns Secondary address string
*/
secondaryAddress(): string;Generate city, state, country, and other geographic location names.
/**
* Generate a city name
* @returns City name string
*/
city(): string;
/**
* Generate a state or province name
* @param options - Configuration options
* @returns State/province name or abbreviation
*/
state(options?: {
abbreviated?: boolean;
}): string;
/**
* Generate a country name
* @param options - Configuration options
* @returns Country name
*/
country(options?: {
variant?: 'common' | 'official';
}): string;
/**
* Generate a country code
* @param options - Configuration options
* @returns Country code (ISO 3166-1)
*/
countryCode(options?: {
variant?: 'alpha-2' | 'alpha-3' | 'numeric';
}): string;Generate postal codes and ZIP codes with locale-specific formatting.
/**
* Generate a postal/ZIP code
* @param options - Configuration options
* @returns Postal code string
*/
zipCode(options?: {
state?: string;
format?: string;
}): string;Generate latitude and longitude coordinates with precision control and geographic constraints.
/**
* Generate a latitude coordinate
* @param options - Configuration options
* @returns Latitude as number
*/
latitude(options?: {
max?: number;
min?: number;
precision?: number;
}): number;
/**
* Generate a longitude coordinate
* @param options - Configuration options
* @returns Longitude as number
*/
longitude(options?: {
max?: number;
min?: number;
precision?: number;
}): number;
/**
* Generate coordinates near a given point
* @param options - Configuration options
* @returns Tuple of [latitude, longitude]
*/
nearbyGPSCoordinate(options?: {
origin?: [number, number];
radius?: number;
isMetric?: boolean;
}): [number, number];Generate cardinal directions and navigation-related data.
/**
* Generate a cardinal direction
* @param options - Configuration options
* @returns Cardinal direction string
*/
cardinalDirection(options?: {
abbreviated?: boolean;
}): string;
/**
* Generate an ordinal direction
* @param options - Configuration options
* @returns Ordinal direction string
*/
ordinalDirection(options?: {
abbreviated?: boolean;
}): string;import { faker } from "@faker-js/faker";
// Generate complete address
const completeAddress = {
street: faker.location.streetAddress(),
secondaryAddress: faker.location.secondaryAddress(),
city: faker.location.city(),
state: faker.location.state(),
zipCode: faker.location.zipCode(),
country: faker.location.country()
};
// Generate coordinates for mapping
const mapLocation = {
name: faker.location.city(),
coordinates: {
lat: faker.location.latitude(),
lng: faker.location.longitude()
},
address: faker.location.streetAddress({ useFullAddress: true })
};
// Generate nearby locations
const centralPoint: [number, number] = [40.7128, -74.0060]; // NYC
const nearbyLocations = Array.from({ length: 5 }, () => ({
name: faker.location.city(),
coordinates: faker.location.nearbyGPSCoordinate({
origin: centralPoint,
radius: 10, // 10km radius
isMetric: true
})
}));
// Generate international addresses
const internationalAddresses = [
{
country: faker.location.country(),
countryCode: faker.location.countryCode({ variant: 'alpha-2' }),
city: faker.location.city(),
postalCode: faker.location.zipCode()
}
];
// Generate navigation data
const directions = {
heading: faker.location.cardinalDirection(),
turn: faker.location.ordinalDirection(),
coordinates: {
start: [faker.location.latitude(), faker.location.longitude()],
end: [faker.location.latitude(), faker.location.longitude()]
}
};Different locales provide appropriate formatting and realistic data for their regions:
import { fakerDE, fakerJA, fakerEN_US } from "@faker-js/faker";
// German addresses
const germanAddress = {
street: fakerDE.location.streetAddress(),
city: fakerDE.location.city(),
zipCode: fakerDE.location.zipCode(),
country: fakerDE.location.country()
};
// Example: "Musterstraße 123, 10115 Berlin, Deutschland"
// Japanese addresses
const japaneseAddress = {
street: fakerJA.location.streetAddress(),
city: fakerJA.location.city(),
zipCode: fakerJA.location.zipCode(),
country: fakerJA.location.country()
};
// Example with Japanese characters and formatting
// US addresses with state abbreviations
const usAddress = {
street: fakerEN_US.location.streetAddress(),
city: fakerEN_US.location.city(),
state: fakerEN_US.location.state({ abbreviated: true }),
zipCode: fakerEN_US.location.zipCode()
};
// Example: "123 Main St, New York, NY 10001"For applications not requiring locale support, SimpleFaker provides basic coordinate generation:
interface SimpleLocationModule {
/**
* Generate a latitude coordinate
* @param options - Configuration options
* @returns Latitude as number
*/
latitude(options?: {
max?: number;
min?: number;
precision?: number;
}): number;
/**
* Generate a longitude coordinate
* @param options - Configuration options
* @returns Longitude as number
*/
longitude(options?: {
max?: number;
min?: number;
precision?: number;
}): number;
/**
* Generate coordinates near a given point
* @param options - Configuration options
* @returns Tuple of [latitude, longitude]
*/
nearbyGPSCoordinate(options?: {
origin?: [number, number];
radius?: number;
isMetric?: boolean;
}): [number, number];
}