Skip to content

Commit 9a9f4b1

Browse files
committed
refactor: replace type-of() with meta.type-of()
1 parent f146dff commit 9a9f4b1

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

scss/functions/_math.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "sass:math";
2+
@use "sass:meta";
23

34
// Return valid calc
45
@function add($value1, $value2, $return-calc: true) {
@@ -10,7 +11,7 @@
1011
@return $value1;
1112
}
1213

13-
@if type-of($value1) == number and type-of($value2) == number and math.compatible($value1, $value2) {
14+
@if meta.type-of($value1) == number and meta.type-of($value2) == number and math.compatible($value1, $value2) {
1415
@return $value1 + $value2;
1516
}
1617

@@ -30,11 +31,11 @@
3031
@return $value1;
3132
}
3233

33-
@if type-of($value1) == number and type-of($value2) == number and math.compatible($value1, $value2) {
34+
@if meta.type-of($value1) == number and meta.type-of($value2) == number and math.compatible($value1, $value2) {
3435
@return $value1 - $value2;
3536
}
3637

37-
@if type-of($value2) != number {
38+
@if meta.type-of($value2) != number {
3839
$value2: unquote("(") + $value2 + unquote(")");
3940
}
4041

scss/mixins/_border-radius.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// stylelint-disable property-disallowed-list
2+
@use "sass:meta";
23
@use "../variables" as *;
34
@use "ltr-rtl" as *;
45

@@ -8,7 +9,7 @@
89
@function valid-radius($radius) {
910
$return: ();
1011
@each $value in $radius {
11-
@if type-of($value) == number {
12+
@if meta.type-of($value) == number {
1213
$return: append($return, max($value, 0));
1314
} @else {
1415
$return: append($return, $value);

scss/mixins/_utilities.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:meta";
12
@use "../variables" as *;
23
@use "../vendor/rfs" as *;
34
@use "ltr-rtl" as *;
@@ -13,15 +14,15 @@
1314
$values: map-get($utility, values);
1415

1516
// If the values are a list or string, convert it into a map
16-
@if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
17+
@if meta.type-of($values) == "string" or meta.type-of(nth($values, 1)) != "list" {
1718
$values: zip($values, $values);
1819
}
1920

2021
@each $key, $value in $values {
2122
$properties: map-get($utility, property);
2223

2324
// Multiple properties are possible, for example with vertical or horizontal margins or paddings
24-
@if type-of($properties) == "string" {
25+
@if meta.type-of($properties) == "string" {
2526
$properties: append((), $properties);
2627
}
2728

@@ -102,7 +103,7 @@
102103
}
103104
}
104105
@if $is-rtl == true {
105-
@if (type-of($value) == "map") {
106+
@if (meta.type-of($value) == "map") {
106107
@include ltr-rtl($property, map-get($value, "ltr"), null, map-get($value, "rtl"), if($enable-important-utilities, !important, null));
107108
} @else {
108109
@include ltr-rtl($property, $value, null, null, if($enable-important-utilities, !important, null));

0 commit comments

Comments
 (0)