Skip to content

Instantly share code, notes, and snippets.

@ErrorProne
Created June 13, 2016 12:03
Show Gist options
  • Save ErrorProne/104ececf8f9ef10e9e64d9d90dba0169 to your computer and use it in GitHub Desktop.
Save ErrorProne/104ececf8f9ef10e9e64d9d90dba0169 to your computer and use it in GitHub Desktop.
export class TypeHelper {
static nullOrUndefined(variable:any):boolean {
return (variable === undefined || variable === null);
}
static value(variable:any, optional:any):any {
if (TypeHelper.nullOrUndefined(variable)) {
return optional;
} else {
return variable;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment