SassyLists 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Changelog
2
2
 
3
+ * `0.4.5`: made `sort()` able to return in descending order
3
4
  * `0.4.4`: fixing a typo in `purge()`
4
5
  * `0.4.3`: improving `insert-nth()`, `prepend()`, `replace-nth()` and `replace()` to prevent from adding empty lists
5
6
  * `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
data/lib/SassyLists.rb CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('SassyLists', :path => extension_path)
5
5
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
6
6
  # Date is in the form of YYYY-MM-DD
7
7
  module SassyLists
8
- VERSION = "0.4.4"
9
- DATE = "2013-12-03"
8
+ VERSION = "0.4.5"
9
+ DATE = "2013-12-06"
10
10
  end
11
11
 
12
12
  module Sass::Script::Functions
@@ -6,18 +6,20 @@
6
6
  // -------------------------------------------------------------------------------
7
7
  // @dependence `last()`
8
8
  // @dependence `insert-nth()`
9
+ // @dependence `reverse()`
9
10
  // -------------------------------------------------------------------------------
10
11
  // @example sort(5 12 4.7 6 69 6) => 4.7, 5, 6, 6, 12, 69
11
12
  // @example sort(5 12 4.7 "8" 6 14px 69 6) => 4.7, 5, 6, 6, 12, 69
12
13
  // -------------------------------------------------------------------------------
13
14
  // @param $list [List] : list
15
+ // @param $ascending [Boolean] : ascending or descending
14
16
  // -------------------------------------------------------------------------------
15
17
  // @raise [Warning] if not unitless number found
16
18
  // -------------------------------------------------------------------------------
17
19
  // @return [List]
18
20
 
19
- @function sort($list) {
20
- $result : nth($list, 1);
21
+ @function sort($list, $ascending: true) {
22
+ $result: nth($list, 1);
21
23
 
22
24
  @if length($list) > 1 {
23
25
 
@@ -60,6 +62,10 @@
60
62
  }
61
63
  }
62
64
 
65
+ @if not $ascending and length($result) > 1 {
66
+ $result: reverse($result);
67
+ }
68
+
63
69
  @return $result;
64
70
  }
65
71
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyLists
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-03 00:00:00.000000000 Z
12
+ date: 2013-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass