mirror of
https://github.com/astefanutti/decktape.git
synced 2025-01-07 14:58:31 +03:00
Polish slides range parsing
This commit is contained in:
parent
353341eb88
commit
0a227884f2
10
decktape.js
10
decktape.js
@ -109,13 +109,13 @@ function parseRange(range) {
|
||||
return '<range> must be a combination of slide indexes and ranges, e.g., \'1-3,5,8\'';
|
||||
let slide, slides = {};
|
||||
while ((slide = regex.exec(range)) !== null) {
|
||||
const [, m, n] = slide;
|
||||
if (typeof n !== 'undefined') {
|
||||
for (let i = parseInt(m); i <= parseInt(n); i++) {
|
||||
const [, m, n] = slide.map(i => parseInt(i));
|
||||
if (isNaN(n)) {
|
||||
slides[m] = true;
|
||||
} else {
|
||||
for (let i = m; i <= n; i++) {
|
||||
slides[i] = true;
|
||||
}
|
||||
} else {
|
||||
slides[parseInt(m)] = true;
|
||||
}
|
||||
}
|
||||
return slides;
|
||||
|
Loading…
Reference in New Issue
Block a user