Skip to content

Instantly share code, notes, and snippets.

@dooman87
Created January 2, 2017 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dooman87/5dc12e77ab2bb75297c3b51765d01f15 to your computer and use it in GitHub Desktop.
Save dooman87/5dc12e77ab2bb75297c3b51765d01f15 to your computer and use it in GitHub Desktop.
Bytes to megabytes using type guard.
private usedMb(): number | undefined {
//Using type guard isNumber()
return isNumber(this.props.usedBytes) ?
(this.props.usedBytes / (1024 * 1024)) :
undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment