Skip to main content

compare-numeric-value-desc ()

Signatures

compare-numeric-value-desc ( $first-pair, $second-pair [, $center] )

Compares two key/value pairs’ values as numbers in descending order. All non-numeric items are shifted left.

Details

Parameters

$first-pair
The first key/value pair for the comparison.
Type
*
$second-pair
The second key/value pair for the comparison.
Type
*
$center
The value indicating the center (zero) position between positive and negative values.
Type
Number
Default
0

Return Value

Number
A positive number when the first given value is greater than the second given value, or a negative number when the second given value is greater than the first given value; otherwise, zero.
compare-numeric-value-desc ()

Returns a function reference to this string comparison method to be used by the sort function.

Details

Return Value

Function
A reference to this string comparison method.

Example

@use '@sass-fairy/list';
@use '@sass-fairy/map';

// 1. As a call
@debug map.compare-numeric-value-desc(b 8em, f 10mm);
// 2

// 2. As a reference
$map: (b: 8em, f: 10mm, d: a, a: 3, c: 1cm, e: 2mm);

@debug list.sort($map, map.compare-numeric-value-desc());
// d a, f 10mm, b 8em, a 3, e 2mm, c 1cm