summaryrefslogtreecommitdiffstats
path: root/js/vendor/dav/lib/fuzzy_url_equals.js
blob: 279eccc03da6e55bc3d9b52082bdb2fa4b3f24ac (plain)
1
2
3
4
5
6
7
8
9
10
'use strict';
export default function fuzzyUrlEquals(one, other) {
  return fuzzyIncludes(one, other) || fuzzyIncludes(other, one);
};

function fuzzyIncludes(one, other) {
  return one.indexOf(other) !== -1 ||
         (other.charAt(other.length -1) === '/' &&
          one.indexOf(other.slice(0, -1)) !== -1);
}