SassyLists 2.2.4 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/README.md +4 -4
- data/lib/SassyLists.rb +2 -2
- data/stylesheets/SassyLists/_chunk.scss +19 -19
- data/stylesheets/SassyLists/_comma-list.scss +12 -12
- data/stylesheets/SassyLists/_contain.scss +23 -23
- data/stylesheets/SassyLists/_count-values.scss +14 -14
- data/stylesheets/SassyLists/_debug.scss +26 -26
- data/stylesheets/SassyLists/_every.scss +19 -19
- data/stylesheets/SassyLists/_explode.scss +23 -23
- data/stylesheets/SassyLists/_first.scss +29 -29
- data/stylesheets/SassyLists/_flatten.scss +20 -20
- data/stylesheets/SassyLists/_has-multiple-values.scss +17 -17
- data/stylesheets/SassyLists/_has-values.scss +17 -17
- data/stylesheets/SassyLists/_insert-nth.scss +27 -27
- data/stylesheets/SassyLists/_intersection.scss +17 -17
- data/stylesheets/SassyLists/_is-empty.scss +21 -21
- data/stylesheets/SassyLists/_is-single.scss +21 -21
- data/stylesheets/SassyLists/_is-symmetrical.scss +25 -25
- data/stylesheets/SassyLists/_last-index.scss +18 -18
- data/stylesheets/SassyLists/_last.scss +26 -26
- data/stylesheets/SassyLists/_loop.scss +29 -29
- data/stylesheets/SassyLists/_prepend.scss +17 -17
- data/stylesheets/SassyLists/_purge.scss +19 -19
- data/stylesheets/SassyLists/_random-value.scss +28 -28
- data/stylesheets/SassyLists/_range.scss +26 -26
- data/stylesheets/SassyLists/_remove-duplicates.scss +20 -20
- data/stylesheets/SassyLists/_remove-nth.scss +25 -25
- data/stylesheets/SassyLists/_remove.scss +21 -21
- data/stylesheets/SassyLists/_replace-nth.scss +25 -25
- data/stylesheets/SassyLists/_replace.scss +24 -24
- data/stylesheets/SassyLists/_reverse.scss +20 -20
- data/stylesheets/SassyLists/_shuffle.scss +19 -19
- data/stylesheets/SassyLists/_slice.scss +34 -34
- data/stylesheets/SassyLists/_some.scss +23 -23
- data/stylesheets/SassyLists/_sort.scss +26 -26
- data/stylesheets/SassyLists/_sum.scss +28 -28
- data/stylesheets/SassyLists/_tail.scss +20 -20
- data/stylesheets/SassyLists/_to-list.scss +18 -18
- data/stylesheets/SassyLists/_to-map.scss +32 -32
- data/stylesheets/SassyLists/_to-string.scss +26 -26
- data/stylesheets/SassyLists/_union.scss +20 -20
- data/stylesheets/SassyLists/_walk.scss +21 -21
- data/stylesheets/SassyLists/helpers/_is-number.scss +10 -10
- data/stylesheets/SassyLists/helpers/_missing-dependencies.scss +10 -10
- data/stylesheets/SassyLists/helpers/_str-compare.scss +12 -12
- data/stylesheets/SassyLists/helpers/_true.scss +10 -10
- data/stylesheets/_SassyLists.scss +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7165f15ff8bae19d58d3c815c4d8f2f2071d6add
|
4
|
+
data.tar.gz: 75b1c89e48ebfc1bd1cfc5084dd26385f09c21ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 518303a65a52457400791bcc5eeb6298dc6c3cd468a9e492f782580cc434e6c30eec2c950ae71f5f32a3cc3c7f0b11b19642bf24105144f508b5e330e65e3d46
|
7
|
+
data.tar.gz: 8a9a4a2041e1068677a67d2054268c35e7021f0da065969bdc63344d55bd4efbe68341a2b726b5196de4ec94eb150021ceacc677e623c36e92d7769de8731ffb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
* `2.2.5`: changing C-style comments to inline comments
|
3
4
|
* `2.2.4`: fixing a documentation error
|
4
5
|
* `2.2.3`: adding examples to documentation
|
5
6
|
* `2.2.2`: fixing a bug with aliases for `sl-to-list()` and moved all comments to C-like
|
@@ -27,7 +28,7 @@
|
|
27
28
|
* making `count-values()` return a map
|
28
29
|
* minor fixes and improvements
|
29
30
|
* improving overall performances
|
30
|
-
* `0.4.9`: removing `compact()` alias for `purge()` (ref [#23](https://github.com/
|
31
|
+
* `0.4.9`: removing `compact()` alias for `purge()` (ref [#23](https://github.com/at-import/SassyLists/issues/23))
|
31
32
|
* `0.4.8`: adding `shuffle()`
|
32
33
|
* `0.4.7`: dramatically improving `sort()` performances and removing all its dependencies
|
33
34
|
* `0.4.6`: fixing an issue when passing an empty list to `chunk()` and improved code quality
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SassyLists [![Gem Version](https://badge.fury.io/rb/SassyLists.svg)](http://badge.fury.io/rb/SassyLists)
|
2
2
|
|
3
|
-
Here is a powerful toolbox providing you all the functions you need to manipulate your [Sass](http://sass-lang.com/) lists. See complete documentation [here](http://
|
3
|
+
Here is a powerful toolbox providing you all the functions you need to manipulate your [Sass](http://sass-lang.com/) lists. See complete documentation [here](http://at-import.github.io/SassyLists/).
|
4
4
|
|
5
5
|
## How to use it
|
6
6
|
|
@@ -55,7 +55,7 @@ Here is a powerful toolbox providing you all the functions you need to manipulat
|
|
55
55
|
* `sl-union()`: returns a list of values from given lists minus duplicates
|
56
56
|
* `sl-walk()`: applies a function to every value of list
|
57
57
|
|
58
|
-
If you feel like an explorer, you can have a look at the code [here](https://github.com/
|
58
|
+
If you feel like an explorer, you can have a look at the code [here](https://github.com/at-import/SassyLists/tree/master/stylesheets).
|
59
59
|
|
60
60
|
## Requirements
|
61
61
|
|
@@ -67,11 +67,11 @@ Some functions depend on other functions. If you include functions individually,
|
|
67
67
|
|
68
68
|
## Also read
|
69
69
|
|
70
|
-
* [Official site](http://
|
70
|
+
* [Official site](http://at-import.github.io/SassyLists)
|
71
71
|
* [Advanced Sass list functions](http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/)
|
72
72
|
* [Advanced Sass list functions again](http://hugogiraudel.com/2013/10/09/advanced-sass-list-functions-again/)
|
73
73
|
* [How I made a Sass debug function](http://hugogiraudel.com/2013/10/21/sass-debug/)
|
74
74
|
|
75
75
|
## Credits
|
76
76
|
|
77
|
-
A lot of thanks to all contributors and to [
|
77
|
+
A lot of thanks to all contributors and to [at-import](https://github.com/at-import) for their support.
|
data/lib/SassyLists.rb
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
16
16
|
# Date is in the form of YYYY-MM-DD
|
17
17
|
module SassyLists
|
18
|
-
VERSION = "2.2.
|
19
|
-
DATE = "
|
18
|
+
VERSION = "2.2.5"
|
19
|
+
DATE = "2016-06-08"
|
20
20
|
end
|
21
21
|
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
///
|
2
|
+
/// Chunks `$list` into `$size` large lists.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-chunk
|
5
|
+
///
|
6
|
+
/// @param {List} $list - list to chunk
|
7
|
+
/// @param {Number} $size - length of lists
|
8
|
+
///
|
9
|
+
/// @throws $size is not a number for `sl-chunk`.
|
10
|
+
///
|
11
|
+
/// @requires sl-to-list
|
12
|
+
///
|
13
|
+
/// @example
|
14
|
+
/// sl-chunk(a b c d e, 2)
|
15
|
+
/// // a b, c d, e
|
16
|
+
///
|
17
|
+
/// @return {List | Null}
|
18
|
+
///
|
19
19
|
|
20
20
|
@function sl-chunk($list, $size) {
|
21
21
|
@if sl-missing-dependencies(sl-to-list) == true { @return null; }
|
@@ -57,4 +57,4 @@
|
|
57
57
|
}
|
58
58
|
|
59
59
|
@return $result;
|
60
|
-
}
|
60
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
///
|
2
|
+
/// Initialize an empty comma-separated list.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-comma-list
|
5
|
+
///
|
6
|
+
/// @example
|
7
|
+
/// sl-comma-list()
|
8
|
+
/// // ()
|
9
|
+
///
|
10
|
+
/// @return {List}
|
11
|
+
///
|
12
12
|
|
13
13
|
@function sl-comma-list() {
|
14
14
|
@return zip((), ());
|
15
|
-
}
|
15
|
+
}
|
@@ -1,31 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
///
|
2
|
+
/// Returns whether `$list` contains `$value`.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-contain
|
5
|
+
///
|
6
|
+
/// @param {List} $list - list to check
|
7
|
+
/// @param {*} $value - value to look for
|
8
|
+
///
|
9
|
+
/// @example
|
10
|
+
/// sl-contain(a b c, a)
|
11
|
+
/// // true
|
12
|
+
///
|
13
|
+
/// @example
|
14
|
+
/// sl-contain(a b c, z)
|
15
|
+
/// // false
|
16
|
+
///
|
17
|
+
/// @return {Bool}
|
18
|
+
///
|
19
19
|
|
20
20
|
@function sl-contain($list, $value) {
|
21
21
|
@return not not index($list, $value);
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
///
|
25
|
+
/// @requires sl-contain
|
26
|
+
/// @alias sl-contain
|
27
|
+
///
|
28
28
|
|
29
29
|
@function sl-include($list, $value) {
|
30
30
|
@return sl-contain($list, $value);
|
31
|
-
}
|
31
|
+
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
///
|
2
|
+
/// Counts the number of occurrences of each value of `$list`.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-count-values
|
5
|
+
///
|
6
|
+
/// @param {List} $list - list to count values from
|
7
|
+
///
|
8
|
+
/// @example
|
9
|
+
/// sl-count-values(a b c a)
|
10
|
+
/// // (a: 2, b: 1, c: 1)
|
11
|
+
///
|
12
|
+
/// @return {Map} Values mapped to their count
|
13
|
+
///
|
14
14
|
|
15
15
|
@function sl-count-values($list) {
|
16
16
|
$map: ();
|
@@ -22,4 +22,4 @@
|
|
22
22
|
}
|
23
23
|
|
24
24
|
@return $map;
|
25
|
-
}
|
25
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
///
|
2
|
+
/// Returns `$list` as a string, prettified if `$pre` is set to true.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#mixin-sl-debug
|
5
|
+
///
|
6
|
+
/// @param {List} $list - list to debug
|
7
|
+
/// @param {Bool} $pre [false] - enable/disable variables type and proper indentation
|
8
|
+
/// @param {Number} $level [1] - internal variable for recursion
|
9
|
+
///
|
10
|
+
/// @requires sl-is-empty
|
11
|
+
/// @requires sl-is-single
|
12
|
+
/// @requires sl-has-multiple-values
|
13
|
+
///
|
14
|
+
/// @example
|
15
|
+
/// sl-debug(a b c)
|
16
|
+
/// // '("a", "b", "c")'
|
17
|
+
///
|
18
|
+
/// @return {String}
|
19
|
+
///
|
20
20
|
|
21
21
|
@function sl-debug($list, $pre: false, $level: 1) {
|
22
22
|
@if sl-missing-dependencies(sl-is-empty, sl-is-single, sl-has-multiple-values) == true { @return null; }
|
@@ -82,13 +82,13 @@
|
|
82
82
|
@return quote($result);
|
83
83
|
}
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
///
|
86
|
+
/// Mixin displaying clean debug
|
87
|
+
///
|
88
|
+
/// @param {List} $list - list
|
89
|
+
///
|
90
|
+
/// @requires sl-debug
|
91
|
+
///
|
92
92
|
|
93
93
|
@mixin sl-debug($list) {
|
94
94
|
body:before {
|
@@ -1,22 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
///
|
2
|
+
/// Tests whether all items from `$list` pass the test implemented by `$function`.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-every
|
5
|
+
///
|
6
|
+
/// @param {List} $list - list to run test against
|
7
|
+
/// @param {String} $function - function to run against every item from list
|
8
|
+
/// @param {ArgList} $args - extra arguments to pass to the function
|
9
|
+
///
|
10
|
+
/// @example
|
11
|
+
/// sl-every(1 2 3, unitless)
|
12
|
+
/// // true
|
13
|
+
///
|
14
|
+
/// @example
|
15
|
+
/// sl-every(1 2 3px, unitless)
|
16
|
+
/// // false
|
17
|
+
///
|
18
|
+
/// @return {Bool}
|
19
|
+
///
|
20
20
|
|
21
21
|
@function sl-every($list, $function, $args...) {
|
22
22
|
@each $item in $list {
|
@@ -1,25 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
///
|
2
|
+
/// Explodes `$string` into a list using `$delimiter` as a delimiter.
|
3
|
+
///
|
4
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-explode
|
5
|
+
///
|
6
|
+
/// @param {String} $string - string to explode
|
7
|
+
/// @param {String} $delimiter [''] - string to use as a delimiter
|
8
|
+
/// @param {String} $separator ['space'] - list separator
|
9
|
+
///
|
10
|
+
/// @throws $string is not a string for `sl-explode`.
|
11
|
+
/// @throws $delimiter is not a string for `sl-explode`.
|
12
|
+
///
|
13
|
+
/// @example
|
14
|
+
/// sl-explode(abc)
|
15
|
+
/// // a b c
|
16
|
+
///
|
17
|
+
/// @example
|
18
|
+
/// sl-explode(abc, b)
|
19
|
+
/// // a c
|
20
|
+
///
|
21
|
+
/// @return {List | Null}
|
22
|
+
///
|
23
23
|
|
24
24
|
@function sl-explode($string, $delimiter: '', $separator: "space") {
|
25
25
|
@if type-of($string) != "string" {
|
@@ -65,4 +65,4 @@
|
|
65
65
|
}
|
66
66
|
|
67
67
|
@return append($result, $remaining, $separator);
|
68
|
-
}
|
68
|
+
}
|
@@ -1,27 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
/// Returns first element of `$list`.
|
2
|
+
///
|
3
|
+
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-first
|
4
|
+
///
|
5
|
+
/// @param {List} $list - list to retrieve first item from
|
6
|
+
///
|
7
|
+
/// @throws Cannot find first item of empty list.
|
8
|
+
///
|
9
|
+
/// @requires sl-is-empty
|
10
|
+
///
|
11
|
+
/// @example
|
12
|
+
/// sl-first(a b c)
|
13
|
+
/// // a
|
14
|
+
///
|
15
|
+
/// @example
|
16
|
+
/// sl-first(a)
|
17
|
+
/// // a
|
18
|
+
///
|
19
|
+
/// @example
|
20
|
+
/// sl-first(())
|
21
|
+
/// // null
|
22
|
+
///
|
23
|
+
/// @return {*}
|
24
|
+
///
|
25
25
|
|
26
26
|
@function sl-first($list) {
|
27
27
|
@if sl-missing-dependencies(sl-is-empty) == true { @return null; }
|
@@ -34,11 +34,11 @@
|
|
34
34
|
@return nth($list, 1);
|
35
35
|
}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
///
|
38
|
+
/// @requires sl-first
|
39
|
+
/// @alias sl-first
|
40
|
+
///
|
41
41
|
|
42
42
|
@function sl-head($list) {
|
43
43
|
@return sl-first($list);
|
44
|
-
}
|
44
|
+
}
|