mon-entreprise/publicodes/source/utils.ts

9 lines
304 B
TypeScript

export function coerceArray<A>(x: A | Array<A>): Array<A> {
return Array.isArray(x) ? x : [x]
}
export function capitalise0(name: undefined): undefined
export function capitalise0(name: string): string
export function capitalise0(name?: string) {
return name && name[0].toUpperCase() + name.slice(1)
}