removeEmptyLines = text => {
  // @ts-ignore
  const byNonEmptyLines = line => !!line?.trim();
  return text.split('\n').filter(byNonEmptyLines).join('\n');
}
Removes empty(whitespace only) lines from given string `text`
@example removeEmptyLines('my\n\n\ntext\n\n') == 'my\ntext'
@param {string} text
@returns {string}