demo/body-parser/lib/types/urlencoded.js
function parameterCount (body, limit) {
  var count = 0
  var index = 0

  while ((index = body.indexOf('&', index)) !== -1) {
    count++
    index++

    if (count === limit) {
      return undefined
    }
  }

  return count
}
function parameterCount (body, limit) {
  var count = 0
  var index = 0

  while ((index = body.indexOf('&', index)) !== -1) {
    count++
    index++

    if (count === limit) {
      return undefined
    }
  }

  return count
}
function parameterCount ( body , limit ) { var count = 0 var index = 0 while ( ( index = body . indexOf ( '&' , index ) ) !== - 1 ) { count ++ index ++ if ( count === limit ) { return undefined } } return count }
Count the number of parameters, stopping once limit reached

@param {string} body
@param {number} limit
@api private
Count the number of parameters stopping once limit reached