index.js
function freeVariableWeight(sliced) {
  return sliced.reduce(function(acc, part, i) {
    // If is bound part
    if (!/^:.+$/.test(part)) {
      // Weight is positively correlated to indexes of bound parts
      acc += Math.pow(i + 1, sliced.length)
    }
    return acc
  }, 0)
}
function freeVariableWeight(sliced) {
  return sliced.reduce(function(acc, part, i) {
    // If is bound part
    if (!/^:.+$/.test(part)) {
      // Weight is positively correlated to indexes of bound parts
      acc += Math.pow(i + 1, sliced.length)
    }
    return acc
  }, 0)
}
function freeVariableWeight ( sliced ) { return sliced . reduce ( function ( acc , part , i ) { // If is bound part if ( ! / ^:.+$ / . test ( part ) ) { // Weight is positively correlated to indexes of bound parts acc += Math . pow ( i + 1 , sliced . length ) } return acc } , 0 ) }
Takes a sliced path and returns an integer representing the
"weight" of its free variables. More specific routes are heavier

Intuitively: when a free variable is at the base of a path e.g.
'/:resource', this is more generic than '/resourceName/:id' and thus has
a lower weight

Weight can only be used to compare paths of the same depth
Takes a sliced path and returns an integer representing the weight of its free variables . More specific routes are heavier