All files / src/utils convertToBase64.ts

80% Statements 4/5
50% Branches 1/2
100% Functions 1/1
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 102x   2x 8x     8x      
import { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'
 
export function convertToBase64(text: string) {
  Iif (isBrowser()) {
    return window.btoa(text)
  } else {
    return Buffer.from(text).toString('base64')
  }
}