MenuIterm selected but clicable mode added
This commit is contained in:
1 parent
74f785134f
commit
822f1a0535
3 files changed
+7
-26
No files matched your search
@@ -1,25 +0,0 @@
|
||||
function getPathWithNoTrailingSlash(path='') {
|
||||
path = path.charAt(path.length - 1) === '/'
|
||||
? path.substr(0, path.length - 1)
|
||||
: path
|
||||
return path.length === 0
|
||||
? '/'
|
||||
: path
|
||||
}
|
||||
|
||||
function isEqualPath(a, b, ignoreTrailingSlash = false) {
|
||||
return ignoreTrailingSlash
|
||||
? getPathWithNoTrailingSlash(a) === getPathWithNoTrailingSlash(b)
|
||||
: a === b
|
||||
}
|
||||
|
||||
function isMatchPathPattern(pattern, path, ignoreTrailingSlash = false) {
|
||||
const test = ignoreTrailingSlash
|
||||
? getPathWithNoTrailingSlash(path)
|
||||
: path
|
||||
return pattern.test(test)
|
||||
}
|
||||
|
||||
exports.getPathWithNoTrailingSlash = getPathWithNoTrailingSlash
|
||||
exports.isMatchPathPattern = isMatchPathPattern
|
||||
exports.isEqualPath = isEqualPath
|
||||
@@ -0,0 +1,3 @@
|
||||
export function isPartOfPath(part: string, path: string): boolean {
|
||||
return path.startsWith(part)
|
||||
}
|
||||
Reference in new issue
Block a user