Skip to content

Instantly share code, notes, and snippets.

@Jakobud
Created April 25, 2017 20:12
Show Gist options
  • Save Jakobud/ec056b52f3673cc369dc97f2c2428424 to your computer and use it in GitHub Desktop.
Save Jakobud/ec056b52f3673cc369dc97f2c2428424 to your computer and use it in GitHub Desktop.
Removed an item for a SASS list based on it's index (mimics behavior of the native map-remove function)
/// list-remove
/// Remove an item from a list
/// @param $list - A SASS list
/// @param $index - The list index to remove
/// @returns A SASS list
/// @author Jake Wilson <[email protected]>
@function list-remove($list, $index) {
$newList: ();
@for $i from 1 through length($list) {
@if $i != $index {
$newList: append($newList, nth($list,$i), 'space');
}
}
@return $newList;
}
@Jikol
Copy link

Jikol commented Mar 28, 2022

I don't want to be nitpicky, but... Sass not SASS

/// @param $list - A SASS list
/// @returns A SASS list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment