All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.scss._utilities.scss Maven / Gradle / Ivy

Go to download

Layout helpers for digital and software products using the Carbon Design System

The newest version!
//
// Copyright IBM Corp. 2018, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

/// Map deep get
/// @author Hugo Giraudel
/// @access public
/// @param {Map} $map - Map
/// @param {Arglist} $keys - Key chain
/// @return {*} Desired value
/// @group @carbon/layout
@function map-deep-get($map, $keys...) {
  @each $key in $keys {
    $map: map.get($map, $key);
  }
  @return $map;
}

/// Provide a map and index, and get back the relevant key value
/// @access public
/// @param {Map} $map - Map
/// @param {Integer} $index - Key chain
/// @return {String} Desired value
/// @group @carbon/layout
@function key-by-index($map, $index) {
  $keys: map.keys($map);
  @return nth($keys, $index);
}

/// Pass in a map, and get the last one in the list back
/// @access public
/// @param {Map} $map - Map
/// @return {*} Desired value
/// @group @carbon/layout
@function last-map-item($map) {
  $total-length: list.length($map);
  @return map-get($map, carbon--key-by-index($map, $total-length));
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy