From 769c8d824600fbf521e3976cc4a3c6152ed4e8ce Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Thu, 23 May 2019 11:56:03 +0200 Subject: Helpers & utilities split (#28445) --- scss/_functions.scss | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'scss/_functions.scss') diff --git a/scss/_functions.scss b/scss/_functions.scss index e867b5521..096b15205 100644 --- a/scss/_functions.scss +++ b/scss/_functions.scss @@ -30,6 +30,30 @@ } } +// Internal Bootstrap function to turn maps into its negative variant. +// If prefixes the keys with `n` and makes the value negative. +@function negativify-map($map) { + $result: (); + @each $key, $value in $map { + @if $key != 0 { + $result: map-merge($result, ("n" + $key: (-$value))); + } + } + @return $result; +} + +// Get multiple keys from a sass map +@function map-get-multiple($map, $values) { + $result: (); + @each $key, $value in $map { + @if (index($values, $key) != null) { + $result: map-merge($result, ($key: $value)); + } + } + @return $map; +} + + // Replace `$search` with `$replace` in `$string` // Used on our SVG icon backgrounds for custom forms. // -- cgit v1.2.3