SassyLists 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +1 -0
- data/lib/SassyLists.rb +2 -2
- data/stylesheets/SassyLists/_chunk.scss +2 -2
- data/stylesheets/SassyLists/_count-values.scss +6 -6
- data/stylesheets/SassyLists/_debug.scss +4 -4
- data/stylesheets/SassyLists/_intersection.scss +29 -0
- data/stylesheets/_SassyLists.scss +1 -0
- metadata +3 -2
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
* `0.4.0`: added `intersection()`
|
3
4
|
* `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
|
4
5
|
* `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
|
5
6
|
* `0.3.3`: removed dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
|
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.
|
9
|
-
DATE = "2013-11-
|
8
|
+
VERSION = "0.4.0"
|
9
|
+
DATE = "2013-11-11"
|
10
10
|
end
|
11
11
|
|
12
12
|
module Sass::Script::Functions
|
@@ -12,20 +12,20 @@
|
|
12
12
|
// @return [List]
|
13
13
|
|
14
14
|
@function count-values($list) {
|
15
|
-
$keys
|
16
|
-
$counts
|
15
|
+
$keys: ();
|
16
|
+
$counts: ();
|
17
17
|
|
18
18
|
@each $item in $list {
|
19
19
|
$index: index($keys, $item);
|
20
20
|
|
21
21
|
@if not $index {
|
22
|
-
$keys
|
23
|
-
$counts
|
22
|
+
$keys: append($keys, $item);
|
23
|
+
$counts: append($counts, 1);
|
24
24
|
}
|
25
25
|
|
26
26
|
@else {
|
27
|
-
$count
|
28
|
-
$counts
|
27
|
+
$count: nth($counts, $index) + 1;
|
28
|
+
$counts: replace-nth($counts, $index, $count);
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
@@ -12,9 +12,9 @@
|
|
12
12
|
// @return [String]
|
13
13
|
|
14
14
|
@function debug($list, $pre: false, $level: 1) {
|
15
|
-
$tab
|
16
|
-
$indent
|
17
|
-
$break
|
15
|
+
$tab: " ";
|
16
|
+
$indent: "";
|
17
|
+
$break: if($pre, "\A ", "");
|
18
18
|
|
19
19
|
@if length($list) == 0 {
|
20
20
|
@return "( )";
|
@@ -25,7 +25,7 @@
|
|
25
25
|
}
|
26
26
|
|
27
27
|
@for $i from 1 to $level {
|
28
|
-
$indent
|
28
|
+
$indent: $indent + $tab;
|
29
29
|
}
|
30
30
|
|
31
31
|
$result: "[" + $break;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Returns a list of shared value from $lists minus duplicates
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation/#intersection
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @dependence `count-values()`
|
6
|
+
// @dependence `flatten()`
|
7
|
+
// -------------------------------------------------------------------------------
|
8
|
+
// @example intersection(a b c, a c d, e d f) => a c d
|
9
|
+
// -------------------------------------------------------------------------------
|
10
|
+
// @param $lists [ArgList] : lists
|
11
|
+
// -------------------------------------------------------------------------------
|
12
|
+
// @return [List]
|
13
|
+
|
14
|
+
@function intersection($lists...) {
|
15
|
+
@if length($lists) == 1 {
|
16
|
+
@return $lists;
|
17
|
+
}
|
18
|
+
|
19
|
+
$list: count-values(flatten($lists));
|
20
|
+
$result: ();
|
21
|
+
|
22
|
+
@each $item in $list {
|
23
|
+
@if nth($item, 2) == length($lists) {
|
24
|
+
$result: append($result, nth($item, 1));
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
@return $result;
|
29
|
+
}
|
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
|
+
version: 0.4.0
|
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-11-
|
12
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- stylesheets/SassyLists/_first.scss
|
60
60
|
- stylesheets/SassyLists/_flatten.scss
|
61
61
|
- stylesheets/SassyLists/_insert-nth.scss
|
62
|
+
- stylesheets/SassyLists/_intersection.scss
|
62
63
|
- stylesheets/SassyLists/_is-symmetrical.scss
|
63
64
|
- stylesheets/SassyLists/_last-index.scss
|
64
65
|
- stylesheets/SassyLists/_last.scss
|