Created
November 16, 2015 14:58
-
-
Save KittyGiraudel/cc3fe6e7450133a86bd8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
/// Performs right-to-left function composition. | |
/// The rightmost function may have any arity; | |
/// the remaining functions must be unary. | |
/// | |
/// @see http://ramdajs.com/docs/#compose Ramda Compose | |
/// | |
/// @param {List} $functions - List of functions to run | |
/// @param {Arglist} $args - List of args to give to last function in $functions | |
/// | |
@function compose($functions, $args...) { | |
$result: call(nth($functions, -1), $args...); | |
@for $i from length($functions) - 1 through 1 { | |
$result: call(nth($functions, $i), $result); | |
} | |
@return $result; | |
} | |
@function pow($number, $exp) { | |
$value: 1; | |
@if $exp > 0 { | |
@for $i from 1 through $exp { | |
$value: $value * $number; | |
} | |
} @else if $exp < 0 { | |
@for $i from 1 through -$exp { | |
$value: $value / $number; | |
} | |
} | |
@return $value; | |
} | |
@function negate($value) { | |
@return $value * -1; | |
} | |
@function inc($value) { | |
@return $value + 1; | |
} | |
.foo { | |
test: compose(inc negate pow, 3, 4); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.foo { | |
test: -80; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment