Skip to content

Commit

Permalink
Merge pull request #17 from kni-labs/pow
Browse files Browse the repository at this point in the history
Pow
  • Loading branch information
dbox committed Feb 4, 2016
2 parents 9f4b796 + 02ea993 commit f859aff
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion knapsack/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@
// Utilities
// ----

//- Function: Rem Calculator


/// Power function
/// @param {Number} $x
/// @param {Number} $n
/// @return {Number}
/// @group utilities
/// @source https://github.com/adambom/Sass-Math/blob/master/math.scss Sass-Math
@function pow($x, $n) {
$result: 1;

@if $n >= 0 {
@for $i from 1 through $n {
$result: $result * $x;
}
} @else {
@for $i from $n to 0 {
$result: $result / $x;
}
}
@return $result;
}

///
/// Calculates and returns the rem value based on px input. Default base font
/// size is 16px, but can be changed with a global `$base-font-size` variable.
Expand Down

0 comments on commit f859aff

Please sign in to comment.