Skip to content

Commit 0717999

Browse files
authored
Update utils.ts (#27)
* Update utils.ts dimIndex now allows starting from zero * added Nikitas Hint
1 parent b42a53e commit 0717999

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/utils.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ export function parseDimIndex(spec: string, count: number): string[] {
8585
const start = parts[0];
8686
const end = parts[1];
8787

88-
if (!start || !end) {
89-
return [];
90-
}
91-
88+
if (start === undefined || end === undefined) {
89+
return [];
90+
}
91+
if ( start < 0 || end < 0 || end < start ) {
92+
throw new Error('dimIndex Element Range Spec invalid.');
93+
}
94+
/*
95+
if (!start || !end) { return []; }
96+
*/
9297
const numElements = end - start + 1;
9398
if (numElements < count) {
9499
throw new Error('dimIndex Element has invalid specification.');

0 commit comments

Comments
 (0)