SassyLists 0.4.9 → 1.0.0
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 +8 -0
- data/lib/SassyLists.rb +2 -2
- data/stylesheets/SassyLists/_chunk.scss +27 -32
- data/stylesheets/SassyLists/_contain.scss +2 -5
- data/stylesheets/SassyLists/_count-values.scss +9 -22
- data/stylesheets/SassyLists/_debug.scss +64 -66
- data/stylesheets/SassyLists/_explode.scss +49 -0
- data/stylesheets/SassyLists/_first.scss +10 -5
- data/stylesheets/SassyLists/_flatten.scss +16 -13
- data/stylesheets/SassyLists/_insert-nth.scss +22 -25
- data/stylesheets/SassyLists/_intersection.scss +12 -13
- data/stylesheets/SassyLists/_is-symmetrical.scss +2 -7
- data/stylesheets/SassyLists/_last-index.scss +7 -9
- data/stylesheets/SassyLists/_last.scss +10 -5
- data/stylesheets/SassyLists/_loop.scss +19 -12
- data/stylesheets/SassyLists/_prepend.scss +7 -8
- data/stylesheets/SassyLists/_purge.scss +8 -9
- data/stylesheets/SassyLists/_random-value.scss +12 -7
- data/stylesheets/SassyLists/_remove-duplicates.scss +8 -17
- data/stylesheets/SassyLists/_remove-nth.scss +2 -12
- data/stylesheets/SassyLists/_remove.scss +4 -9
- data/stylesheets/SassyLists/_replace-nth.scss +7 -29
- data/stylesheets/SassyLists/_replace.scss +14 -23
- data/stylesheets/SassyLists/_reverse.scss +14 -20
- data/stylesheets/SassyLists/_shuffle.scss +14 -10
- data/stylesheets/SassyLists/_slice.scss +25 -33
- data/stylesheets/SassyLists/_sort.scss +25 -39
- data/stylesheets/SassyLists/_sum.scss +12 -17
- data/stylesheets/SassyLists/_to-string.scss +10 -21
- data/stylesheets/SassyLists/_union.scss +3 -2
- data/stylesheets/SassyLists/helpers/_str-compare.scss +27 -0
- data/stylesheets/SassyLists/helpers/_true.scss +15 -0
- data/stylesheets/_SassyLists.scss +3 -0
- metadata +5 -2
@@ -4,35 +4,24 @@
|
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @alias `stringify()`
|
6
6
|
// -------------------------------------------------------------------------------
|
7
|
-
// @example to-string(a b c) => abc
|
8
|
-
// @example to-string(a (b c) d) => abcd
|
9
|
-
// @example to-string(a b c, '-') => a-b-c
|
10
|
-
// -------------------------------------------------------------------------------
|
11
7
|
// @param $list [List] : list
|
12
8
|
// @param $glue [String] : value to use as a join string
|
13
|
-
// @param $root [Boolean] : strictly internal boolean for recursivity
|
14
9
|
// -------------------------------------------------------------------------------
|
15
10
|
// @return [String]
|
16
11
|
|
17
|
-
@function to-string($list, $glue: ''
|
18
|
-
|
19
|
-
|
20
|
-
@for $i from 1 through length($list) {
|
21
|
-
$item: nth($list, $i);
|
22
|
-
|
23
|
-
@if length($item) > 1 {
|
24
|
-
$result: $result + to-string($item, $glue, false);
|
25
|
-
}
|
12
|
+
@function to-string($list, $glue: '') {
|
13
|
+
$result: '';
|
14
|
+
$length: length($list);
|
26
15
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
@for $i from 1 through $length {
|
17
|
+
$item: nth($list, $i);
|
18
|
+
$result: $result + if(length($item) > 1, to-string($item, $glue), $item + $glue);
|
19
|
+
}
|
31
20
|
|
32
|
-
|
21
|
+
@return quote(str-slice($result, 1, str-length($glue) * -1 - 1));
|
33
22
|
}
|
34
23
|
|
35
24
|
// Alias
|
36
|
-
@function stringify($list, $glue: ''
|
37
|
-
|
25
|
+
@function stringify($list, $glue: '') {
|
26
|
+
@return to-string($list, $glue);
|
38
27
|
}
|
@@ -14,10 +14,11 @@
|
|
14
14
|
// @return [List]
|
15
15
|
|
16
16
|
@function union($lists...) {
|
17
|
-
|
17
|
+
$result: remove-duplicates(flatten($lists));
|
18
|
+
@return if(length($result) == 1, nth($result, 1), $result);
|
18
19
|
}
|
19
20
|
|
20
21
|
// Alias
|
21
22
|
@function merge($lists...) {
|
22
|
-
|
23
|
+
@return union($lists...);
|
23
24
|
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Compares two values based on alphabetical order
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @private
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @usage sort()
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @param $a [Literal] : first value
|
8
|
+
// @param $b [Literal] : second value
|
9
|
+
// @param $matrix [List] : alphabetical order
|
10
|
+
// -------------------------------------------------------------------------------
|
11
|
+
// @return [Boolean]
|
12
|
+
|
13
|
+
@function str-compare($a, $b, $order) {
|
14
|
+
@if type-of($a) == "number" and type-of($b) == "number" {
|
15
|
+
@return $a < $b;
|
16
|
+
}
|
17
|
+
$a: to-lower-case($a + unquote(""));
|
18
|
+
$b: to-lower-case($b + unquote(""));
|
19
|
+
@for $i from 1 through min(str-length($a), str-length($b)) {
|
20
|
+
$char-a: str-slice($a, $i, $i);
|
21
|
+
$char-b: str-slice($b, $i, $i);
|
22
|
+
@if $char-a and $char-b and index($order, $char-a) != index($order, $char-b) {
|
23
|
+
@return index($order, $char-a) < index($order, $char-b);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
@return str-length($a) < str-length($b);
|
27
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// Returns truthiness of a value
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @private
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @usage `insert-nth()`
|
6
|
+
// @usage `prepend()`
|
7
|
+
// @usage `purge()`
|
8
|
+
// -------------------------------------------------------------------------------
|
9
|
+
// @param $value [Literal] : value
|
10
|
+
// -------------------------------------------------------------------------------
|
11
|
+
// @return [Boolean]
|
12
|
+
|
13
|
+
@function is-true($value) {
|
14
|
+
@return if($value == null, false, $value and $value != null and $value != "" and $value != ());
|
15
|
+
}
|
@@ -6,10 +6,13 @@
|
|
6
6
|
// Repository: https://github.com/Team-Sass/SassyLists/
|
7
7
|
// -------------------------------------------------------------------------------
|
8
8
|
|
9
|
+
@import "SassyLists/helpers/true";
|
10
|
+
@import "SassyLists/helpers/str-compare";
|
9
11
|
@import "SassyLists/chunk";
|
10
12
|
@import "SassyLists/contain";
|
11
13
|
@import "SassyLists/count-values";
|
12
14
|
@import "SassyLists/debug";
|
15
|
+
@import "SassyLists/explode";
|
13
16
|
@import "SassyLists/first";
|
14
17
|
@import "SassyLists/flatten";
|
15
18
|
@import "SassyLists/insert-nth";
|
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: 1.0.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: 2014-
|
12
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
@@ -52,10 +52,13 @@ extra_rdoc_files: []
|
|
52
52
|
files:
|
53
53
|
- CHANGELOG.md
|
54
54
|
- lib/SassyLists.rb
|
55
|
+
- stylesheets/SassyLists/helpers/_str-compare.scss
|
56
|
+
- stylesheets/SassyLists/helpers/_true.scss
|
55
57
|
- stylesheets/SassyLists/_chunk.scss
|
56
58
|
- stylesheets/SassyLists/_contain.scss
|
57
59
|
- stylesheets/SassyLists/_count-values.scss
|
58
60
|
- stylesheets/SassyLists/_debug.scss
|
61
|
+
- stylesheets/SassyLists/_explode.scss
|
59
62
|
- stylesheets/SassyLists/_first.scss
|
60
63
|
- stylesheets/SassyLists/_flatten.scss
|
61
64
|
- stylesheets/SassyLists/_insert-nth.scss
|