Sha256: c62dc34765dc42dfd6d8bb95113f923e60ecd87a467d27dab956e2f554040a4e
Contents?: true
Size: 1.58 KB
Versions: 15
Compression:
Stored size: 1.58 KB
Contents
// --------------------------------------------------------------------------- // Sass List Helpers // // - list-sum() // - query-list() // --------------------------------------------------------------------------- // Functions // Return the sum of all items in a list. // // list-sum($list) // - $list : <list> @function list-sum($list) { $sum: 0; @each $item in $list { $sum: $sum + $item; } @return $sum; } // Return list of index locations where a query appears in a list, // including unit queries. // // query-list($list, $query [, $mode]) // - $list : <list> // - $query : <anything> // - $mode : none | unit // - "none" (default) runs a standard query. // - "unit" finds all items with the same unit. @function query-list( $list, $query, $mode: none ) { $return: (); // loop through $list @for $i from 1 through length($list) { @if $mode == unit { // if the list item matches the query, write where it is to the list. @if unit(nth($list, $i)) == $query { $return: append($return, $i); } } @else { // if the list item matches the query, write where it is to the list. @if nth(nth($list, $i), 1) == $query { $return: append($return, $i); } } } // if nothing matches then return false. @if $return == () { $return: false; } // return list. @return $return; } // Reverses direction of a list @function reverse($list) { $length: length($list); $return: (); @for $i from 0 to $length { $return: append($return, nth($list, $length - $i)); } @return $return; }
Version data entries
15 entries across 15 versions & 1 rubygems