code: function countLines (str) {
    if (str) {
      let lines = str.match(/\n/g);
      if (lines) {
        return lines.length;
      }
    }
    return 0;
  }
docs: Counts the number of lines in the given string
  
  @param {string} str
  @returns {number}