rudeshark.net/src/prelude/ensure.ts

11 lines
254 B
TypeScript
Raw Normal View History

2019-04-13 07:45:51 +02:00
/**
* null undefined
*/
export function ensure<T>(x: T): NonNullable<T> {
if (x == null) {
throw 'ぬるぽ';
} else {
return x!;
}
}