Skip to content

Commit f859aff

Browse files
committed
Merge pull request #17 from kni-labs/pow
Pow
2 parents 9f4b796 + 02ea993 commit f859aff

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

knapsack/_utilities.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,29 @@
22
// Utilities
33
// ----
44

5-
//- Function: Rem Calculator
5+
6+
7+
/// Power function
8+
/// @param {Number} $x
9+
/// @param {Number} $n
10+
/// @return {Number}
11+
/// @group utilities
12+
/// @source https://github.com/adambom/Sass-Math/blob/master/math.scss Sass-Math
13+
@function pow($x, $n) {
14+
$result: 1;
15+
16+
@if $n >= 0 {
17+
@for $i from 1 through $n {
18+
$result: $result * $x;
19+
}
20+
} @else {
21+
@for $i from $n to 0 {
22+
$result: $result / $x;
23+
}
24+
}
25+
@return $result;
26+
}
27+
628
///
729
/// Calculates and returns the rem value based on px input. Default base font
830
/// size is 16px, but can be changed with a global `$base-font-size` variable.

0 commit comments

Comments
 (0)