code: function sniffLineEndings(text) {
          var subset = text.substr(0, 1000);  // (length is clipped to text.length)
          var hasCRLF = /\r\n/.test(subset);
          var hasLF = /[^\r]\n/.test(subset);
  
          if ((hasCRLF && hasLF) || (!hasCRLF && !hasLF)) {
              return null;
          } else {
              return hasCRLF ? LINE_ENDINGS_CRLF : LINE_ENDINGS_LF;
          }
      }
docs: Scans the first 1000 chars of the text to determine how it encodes line endings. Returns
  null if usage is mixed or if no line endings found.
  @param {!string} text
  @return {null|LINE_ENDINGS_CRLF|LINE_ENDINGS_LF}