diff options
Diffstat (limited to 'src/helpers/arrayFunctions.ts')
| -rw-r--r-- | src/helpers/arrayFunctions.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/helpers/arrayFunctions.ts b/src/helpers/arrayFunctions.ts index 7e78e29..234e135 100644 --- a/src/helpers/arrayFunctions.ts +++ b/src/helpers/arrayFunctions.ts @@ -42,15 +42,15 @@ export function range( throw new Error('step must be greater than 0'); } - // If remove is specified, remove the values from the range - if (remove) { - for (let i = start; i <= end; i += step) { + // Generate an array from start to end + for (let i = start; i <= end; i += step) { + if (remove) { if (!remove.includes(i)) { rangeArray.push(i); } + } else { + rangeArray.push(i); } } - - // return the range return rangeArray; } |
