SassyLists 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Changelog
2
2
 
3
+ * `0.4.1`: improved `intersection()` perf
3
4
  * `0.4.0`: added `intersection()`
4
5
  * `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
5
6
  * `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
data/lib/SassyLists.rb CHANGED
@@ -5,7 +5,7 @@ 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.0"
8
+ VERSION = "0.4.1"
9
9
  DATE = "2013-11-11"
10
10
  end
11
11
 
@@ -1,28 +1,27 @@
1
- // Returns a list of shared value from $lists minus duplicates
1
+ // Returns a list of shared value from $list and $lists minus duplicates
2
2
  // -------------------------------------------------------------------------------
3
3
  // @documentation http://sassylists.com/documentation/#intersection
4
4
  // -------------------------------------------------------------------------------
5
- // @dependence `count-values()`
6
- // @dependence `flatten()`
5
+ // @example intersection(a b c d, a c d, e d a f) => a d
7
6
  // -------------------------------------------------------------------------------
8
- // @example intersection(a b c, a c d, e d f) => a c d
9
- // -------------------------------------------------------------------------------
10
- // @param $lists [ArgList] : lists
7
+ // @param $list [List] : first list
8
+ // @param $lists [ArgList] : other lists
11
9
  // -------------------------------------------------------------------------------
12
10
  // @return [List]
13
11
 
14
- @function intersection($lists...) {
15
- @if length($lists) == 1 {
16
- @return $lists;
17
- }
12
+ @function intersection($list, $lists...) {
13
+ $result: $list;
18
14
 
19
- $list: count-values(flatten($lists));
20
- $result: ();
15
+ @each $list in $lists {
16
+ $temp: ();
21
17
 
22
- @each $item in $list {
23
- @if nth($item, 2) == length($lists) {
24
- $result: append($result, nth($item, 1));
18
+ @each $item in $result {
19
+ @if not not index($list, $item) {
20
+ $temp: append($temp, $item);
21
+ }
25
22
  }
23
+
24
+ $result: $temp;
26
25
  }
27
26
 
28
27
  @return $result;
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.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: