/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ exports.getNumberOfLines = function getNumberOfLines(str) { var nr = -1; var idx = -1; do { nr++ idx = str.indexOf("\n", idx + 1); } while(idx >= 0); return nr; };