11 lines
No EOL
367 B
TypeScript
11 lines
No EOL
367 B
TypeScript
export const cSet = <T>(...values: T[]) => new Set(values)
|
|
|
|
export const cMap = <K extends string, V>(object: Partial<Record<K, V>>): Map<K, V> => {
|
|
const result = new Map<K, V>();
|
|
Object.entries(object).forEach(([k, v]) => result.set(k as K, v as V))
|
|
return result
|
|
}
|
|
|
|
export const throwError = (message: string): never => {
|
|
throw new Error(message)
|
|
} |