Sha256: 8ce665eba27e289d9e7a1463640da3ad3f8f22acb5f9ffd3ffe907cd60e0c1ff

Contents?: true

Size: 917 Bytes

Versions: 37

Compression:

Stored size: 917 Bytes

Contents

///
/// Replaces `$old` by `$new` in `$list`.
///
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-replace
///
/// @requires sl-is-true
/// @requires sl-purge
/// @requires sl-to-list
///
/// @param {List}    $list  - list to update
/// @param {*}       $old   - value to replace
/// @param {*}       $value - new value for $old
///
/// @example
/// sl-replace(a b c, b, z)
/// // a z c
///
/// @example
/// sl-replace(a b c, y, z)
/// // a b c
/// 
/// @return {List}
///
 
@function sl-replace($list, $old, $value) {
  $_: sl-missing-dependencies('sl-is-true', 'sl-purge', 'sl-to-list');

  $running: true;

  @while $running {
    $index: index($list, $old);

    @if not $index {
      $running: false;
    }

    @else {
      $list: set-nth($list, $index, $value);
    }

  }

  $list: if(sl-is-true($value), $list, sl-purge($list));
  
  @return sl-to-list($list);
}

Version data entries

37 entries across 37 versions & 7 rubygems

Version Path
foundation-rails-6.9.0.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.6.2.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.2.2 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.6.1.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.5.3.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.2.1 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.5.1.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
locomotivecms_wagon-2.4.1 generators/foundation/public/stylesheets/foundation6/vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.2.0 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
locomotivecms_wagon-2.4.0 generators/foundation/public/stylesheets/foundation6/vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.4.3.0 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.9 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.8 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.7 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.6 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.5 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.4 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.3 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
bedrock_sass-0.1.2 assets/_vendor/foundation/_vendor/sassy-lists/stylesheets/functions/_replace.scss
foundation-rails-6.4.1.3 vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss