Skip to content

Utilities

A list of all the utilities available in Faker.js.

mergeLocales

Merges the given locales into one locale. The locales are merged in the order they are given. The first locale that provides an entry for a category will be used for that. Mutating the category entries in the returned locale will also mutate the entries in the respective source locale.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
localesLocaleDefinition[]

The locales to merge.

Returns: LocaleDefinition

ts
function mergeLocales(locales: LocaleDefinition[]): LocaleDefinition;

Examples

ts
import { de_CH, de, en, mergeLocales } from '@faker-js/faker';

const de_CH_with_fallbacks = mergeLocales([ de_CH, de, en ]);

Released under the MIT License.