MCPcopy Create free account
hub / github.com/formatjs/formatjs / mergeConfigs

Function mergeConfigs

packages/intl-messageformat/core.ts:43–58  ·  view source on GitHub ↗
(
  defaultConfig: Formats,
  configs?: Partial<Formats>
)

Source from the content-addressed store, hash-verified

41}
42
43function mergeConfigs(
44 defaultConfig: Formats,
45 configs?: Partial<Formats>
46): Formats {
47 if (!configs) {
48 return defaultConfig
49 }
50
51 return (Object.keys(defaultConfig) as Array<keyof Formats>).reduce(
52 (all: Formats, k: keyof Formats) => {
53 all[k] = mergeConfig(defaultConfig[k], configs[k])
54 return all
55 },
56 {...defaultConfig}
57 )
58}
59
60export interface Options extends Omit<ParserOptions, 'locale'> {
61 formatters?: Formatters

Callers 1

constructorMethod · 0.85

Calls 1

mergeConfigFunction · 0.85

Tested by

no test coverage detected