docs
utils
JavaScript
function openPdf() {
  let byteCharacters = window.atob(this.src.split('base64,')[1]);
  let byteNumbers = new Array(byteCharacters.length);
  for (let i = 0; i < byteCharacters.length; i++) {
    byteNumbers[i] = byteCharacters.charCodeAt(i);
  }
  let byteArray = new Uint8Array(byteNumbers);
  let file = new Blob([byteArray], { type: 'application/pdf;base64' });
  let fileURL = URL.createObjectURL(file);
  window.open(fileURL);
}
Object.assign(document.createElement('a'), {
  target: '_blank',
  href: payment.printHref,
  rel: 'noopener'
}).click();
constructor() {
  // reload route on param "companyId" change
  this.router.routeReuseStrategy.shouldReuseRoute = () => false;
}
 
ngOnInit() {
    this.item = window.history.state.collect;
}
.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' })
function getLocalTimeZone(): string {
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
}
const type = base64Data.split(';')[0].split('/')[1];
const parsedMonth = String(month).padStart(2, '0');
// 02
let chars = ['A', 'B', 'A', 'C', 'B'];
let uniqueChars = [...new Set(chars)];
 
this.lista = [...new Map(this.lista.map(item => [item['id'], item])).values()];
type $Keys<T extends object> = keyof T;
new Intl.NumberFormat('en-US', { notation: "compact" }).format("265")
/**
 * Decode a base64 value to an object.
 *
 * @param {String} string
 * @return {Object}
 */
export const decodeBase64 = (str: string) => {
  const body = Buffer.from(str, 'base64').toString('utf8')
  return JSON.parse(body)
}
 
/**
 * Encode an object into a base64-encoded JSON string.
 *
 * @param {Object} obj
 * @return {String}
 * @private
 */
export const encodeBase64 = (obj: object | string) => {
  const str = JSON.stringify(obj)
  return Buffer.from(str).toString('base64')
}