MCPcopy
hub / github.com/formatjs/formatjs / asArray

Function asArray

tools/generate-cldr-locales.ts:19–24  ·  view source on GitHub ↗
(value: T | T[] | undefined)

Source from the content-addressed store, hash-verified

17}
18
19function asArray<T>(value: T | T[] | undefined): T[] {
20 if (value === undefined) {
21 return []
22 }
23 return Array.isArray(value) ? value : [value]
24}
25
26function isCanonicalLocale(locale: string): boolean {
27 try {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected