range.down()
// Sass.
@use 'sass:list';
// Functions.
@use '../../meta/meta.of-type.function';
// The `math.range-down()` or `range.down()` function.
@function down($from, $to, $step: 1, $except: null, $separator: auto) {
@if meta.of-type(number, $from, $to, $step) and $from > $to {
$result: ();
$number: $from;
@if $step > 0 {
$step: $step * -1;
}
@while $number >= $to {
$result: if(
not $except or ($except and not list.index($except, $number)),
list.append($result, $number, $separator),
$result
);
$number: $number + $step;
}
@return if(list.length($result) > 0, $result, null);
}
@return null;
}https://github.com/angular-package/sass/blob/main/math/range/_range.down.function.scss
Parameters
$from
$from$to
$to$step: 1
$step: 1$except: null
$except: null $separator: auto
$separator: autoReturn
Examples
Last updated