Commit 8bf9a5e0 authored by Robert Knight's avatar Robert Knight

Reduce `pageLabelInRange` nesting by using an early return

parent 11234150
......@@ -8,7 +8,10 @@
* specify an empty range.
*/
export function pageLabelInRange(label: string, range: string): boolean {
if (range.includes('-')) {
if (!range.includes('-')) {
return label === range;
}
let [start, end] = range.split('-');
if (!start) {
start = label;
......@@ -30,7 +33,4 @@ export function pageLabelInRange(label: string, range: string): boolean {
} else {
return false;
}
} else {
return label === range;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment