dist/crocodoc.viewer.js
function (str, token) {
            var total = 0, i;
            while ((i = str.indexOf(token, i) + 1)) {
                total++;
            }
            return total;
        }
function (str, token) {
            var total = 0, i;
            while ((i = str.indexOf(token, i) + 1)) {
                total++;
            }
            return total;
        }
function ( str , token ) { var total = 0 , i ; while ( ( i = str . indexOf ( token , i ) + 1 ) ) { total ++ ; } return total ; }
Count and return the number of occurrences of token in str
@param   {string} str   The string to search
@param   {string} token The string to search for
@returns {int}          The number of occurrences
Count and return the number of occurrences of token in str