UNPKG

augnitoambientsdk

Version:

Use this typescript SDK to integrate Augnito’s Ambient Tech within your EMR. To get access credentials or know more about how Augnito Ambient can benefit you, please visit our website and connect with our sales team: https://augnito.ai/

31 lines (22 loc) 721 B
export class Guard { private static instance: Guard; private constructor() { // Constructor is private } static get Against(): Guard { if (!Guard.instance) { Guard.instance = new Guard(); } return Guard.instance; } public NullOrUndefined<T>(value: T | undefined, paramName: string): T { if (value === null) throw new TypeError(`${paramName} is null`); if (value === undefined) throw new TypeError(`${paramName} is undefined`); return value; } public NullOrEmpty<T>(value: T | undefined, paramName: string): T { value = Guard.Against.NullOrUndefined<T>(value, paramName); if (!value) throw new TypeError(`${paramName} is empty`); return value; } }