Sha256: bee6a1efd0f0004d2ad338d69b61b28ba063b33621d143502167496968e0acd8

Contents?: true

Size: 1.49 KB

Versions: 23

Compression:

Stored size: 1.49 KB

Contents

/// Removes a specific item from a list.
/// @author Hugo Giraudel
/// @param {list} $list List.
/// @param {integer} $index Index.
/// @return {list} Updated list.
@function remove-nth($list, $index) {

  $result: null;

  @if type-of($index) != number {
    @warn "$index: #{quote($index)} is not a number for `remove-nth`.";
  }
  @else if $index == 0 {
    @warn "List index 0 must be a non-zero integer for `remove-nth`.";
  }
  @else if abs($index) > length($list) {
    @warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
  }
  @else {

    $result: ();
    $index: if($index < 0, length($list) + $index + 1, $index);

    @for $i from 1 through length($list) {

      @if $i != $index {
        $result: append($result, nth($list, $i));
      }

    }

  }

  @return $result;

}

/// Gets a value from a map.
/// @author Hugo Giraudel
/// @param {map} $map Map.
/// @param {string} $keys Key(s).
/// @return {string} Value.
@function val($map, $keys...) {

  @if nth($keys, 1) == null {
    $keys: remove-nth($keys, 1);
  }

  @each $key in $keys {
    $map: map-get($map, $key);
  }

  @return $map;

}

/// Gets a font value.
/// @param {string} $keys Key(s).
/// @return {string} Value.
@function _font($keys...) {
  @return val($font, $keys...);
}

/// Gets a palette value.
/// @param {string} $keys Key(s).
/// @return {string} Value.
@function _palette($keys...) {
  @return val($palette, $keys...);
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ledger_sync-3.0.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.6.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.5.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.4.4 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.3.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.2.3 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.2.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.2.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.0.2 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.0.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.0.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-2.0.0.pre.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.8.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.8.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.7.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.6.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.5.2 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.5.1 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.5.0 documentation/site/_sass/imports/_functions.scss
ledger_sync-1.4.4 documentation/site/_sass/imports/_functions.scss