diff options
Diffstat (limited to 'js/dav/lib/fuzzy_url_equals.js')
-rw-r--r-- | js/dav/lib/fuzzy_url_equals.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/js/dav/lib/fuzzy_url_equals.js b/js/dav/lib/fuzzy_url_equals.js new file mode 100644 index 00000000..279eccc0 --- /dev/null +++ b/js/dav/lib/fuzzy_url_equals.js @@ -0,0 +1,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); +} |