Skip to content

Commit 06ab8a9

Browse files
committed
refactor: replace str-index() with string.index(), str-length() with string.length(), str-slice() with string.slice(), and quote() with string.quote()
1 parent 4cd8c37 commit 06ab8a9

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

scss/_variables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "sass:color";
2+
@use "sass:string";
23
@use "functions/assert" as *;
34
@use "functions/color" as *;
45
@use "functions/math" as *;
@@ -1842,7 +1843,7 @@ $breadcrumb-margin-bottom: 1rem !default;
18421843
$breadcrumb-bg: null !default;
18431844
$breadcrumb-divider-color: var(--#{$prefix}secondary-color) !default;
18441845
$breadcrumb-active-color: var(--#{$prefix}secondary-color) !default;
1845-
$breadcrumb-divider: quote("/") !default;
1846+
$breadcrumb-divider: string.quote("/") !default;
18461847
$breadcrumb-divider-flipped: $breadcrumb-divider !default;
18471848
$breadcrumb-border-radius: null !default;
18481849
// scss-docs-end breadcrumb-variables

scss/functions/_escape-svg.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:string";
12
@use "../variables" as *;
23
@use "str-replace" as *;
34

@@ -6,11 +7,11 @@
67
// Requires the use of quotes around data URIs.
78

89
@function escape-svg($string) {
9-
@if str-index($string, "data:image/svg+xml") {
10+
@if string.index($string, "data:image/svg+xml") {
1011
@each $char, $encoded in $escaped-characters {
1112
// Do not escape the url brackets
12-
@if str-index($string, "url(") == 1 {
13-
$string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
13+
@if string.index($string, "url(") == 1 {
14+
$string: url("#{str-replace(string.slice($string, 6, -3), $char, $encoded)}");
1415
} @else {
1516
$string: str-replace($string, $char, $encoded);
1617
}

scss/functions/_str-replace.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:string";
12
// Replace `$search` with `$replace` in `$string`
23
// Used on our SVG icon backgrounds for custom forms.
34
//
@@ -7,10 +8,10 @@
78
// @param {String} $replace ('') - New value
89
// @return {String} - Updated string
910
@function str-replace($string, $search, $replace: "") {
10-
$index: str-index($string, $search);
11+
$index: string.index($string, $search);
1112

1213
@if $index {
13-
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
14+
@return string.slice($string, 1, $index - 1) + $replace + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
1415
}
1516

1617
@return $string;

scss/mixins/_ltr-rtl.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
@function reflect($element) {
2222
$string: #{$element};
23-
@if str-index($string, "left") {
23+
@if string.index($string, "left") {
2424
@return str-replace($string, "left", "right");
2525
}
26-
@if str-index($string, "right") {
26+
@if string.index($string, "right") {
2727
@return str-replace($string, "right", "left");
2828
}
2929

scss/mixins/_utilities.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use "sass:list";
22
@use "sass:map";
33
@use "sass:meta";
4+
@use "sass:string";
45
@use "../variables" as *;
56
@use "../vendor/rfs" as *;
67
@use "ltr-rtl" as *;
@@ -38,7 +39,7 @@
3839
// State params to generate pseudo-classes
3940
$state: if(map.has-key($utility, state), map.get($utility, state), ());
4041

41-
$infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
42+
$infix: if($property-class == "" and string.slice($infix, 1, 1) == "-", string.slice($infix, 2), $infix);
4243

4344
// Don't prefix if value key is null (e.g. with shadow class)
4445
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");

scss/vendor/_rfs.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height
222222
}
223223

224224
// Remove first space
225-
@return string.unquote(str-slice($val, 2));
225+
@return string.unquote(string.slice($val, 2));
226226
}
227227

228228
// Helper function to get the responsive value calculated by RFS
@@ -278,7 +278,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height
278278
}
279279

280280
// Remove first space
281-
@return string.unquote(str-slice($val, 2));
281+
@return string.unquote(string.slice($val, 2));
282282
}
283283

284284
// RFS mixin

0 commit comments

Comments
 (0)