Arrays

const minimum = <T,>(xs: T[]): T => {
  return xs.reduce((p, v) => (p < v ? p : v));
};

Math

const countDecimalPlaces = (value) => {
  if (!value) {
    return 0;
  }
  const text = value.toString();
  const i = text.indexOf('e-');
  if (i > -1) {
    return parseInt(text.slice(i + 2), 10);
  }
  const j = text.indexOf('.');
  if (j > -1) {
    return text.length - j - 1;
  }
  return 0;
};

DOM

Forms

<select id="idSelect">
  <option value="1">a</option>
  <option value="2" selected="selected">b</option>
</select>
let e = document.getElementById("idSelect");
let value = e.value; // 2
let text = e.options[e.selectedIndex].text; // "b"

Download file

const downloadBlob = (blob: Blob, fileName: string) => {
  const url = URL.createObjectURL(blob);

  const link = document.createElement('a');
  link.style.display = 'none';
  link.href = url;
  link.setAttribute('download', fileName);

  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  URL.revokeObjectURL(url);
};