Simple auth api (no db)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
export type StringMap<T> = {
|
||||
[key: string]: T;
|
||||
};
|
||||
|
||||
export function narrow<T>(s: T, defd: T, ...allowed: T[]): T {
|
||||
if (allowed.includes(s) || s == defd) {
|
||||
return s;
|
||||
} else {
|
||||
return defd;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user