lib/cookie.js
// array is in longest-to-shortest order.  Handy for indexing.
array is in longest-to-shortest order.  Handy for indexing.
array is in longest - to - shortest order . Handy for indexing .
function permutePath(path) {
  validators.validate(validators.isString(path));
  if (path === "/") {
    return ["/"];
  }
  const permutations = [path];
  while (path.length > 1) {
    const lindex = path.lastIndexOf("/");
    if (lindex === 0) {
      break;
    }
    path = path.substr(0, lindex);
    permutations.push(path);
  }
  permutations.push("/");
  return permutations;
}
function permutePath ( path ) { validators . validate ( validators . isString ( path ) ) ; if ( path === "/" ) { return [ "/" ] ; } const permutations = [ path ] ; while ( path . length > 1 ) { const lindex = path . lastIndexOf ( "/" ) ; if ( lindex === 0 ) { break ; } path = path . substr ( 0 , lindex ) ; permutations . push ( path ) ; } permutations . push ( "/" ) ; return permutations ; }
array is in longest-to-shortest order.
array is in longest - to - shortest order .