contacts/js/dav/lib/fuzzy_url_equals.js

12 lines
343 B
JavaScript

'use strict';
export default function fuzzyUrlEquals(one, other) {
other = encodeURI(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);
}