SassyLists 2.2.1 → 2.2.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +1 -1
- data/lib/SassyLists.rb +2 -2
- data/stylesheets/SassyLists/_chunk.scss +15 -13
- data/stylesheets/SassyLists/_comma-list.scss +7 -5
- data/stylesheets/SassyLists/_contain.scss +15 -11
- data/stylesheets/SassyLists/_count-values.scss +10 -8
- data/stylesheets/SassyLists/_debug.scss +22 -18
- data/stylesheets/SassyLists/_every.scss +12 -8
- data/stylesheets/SassyLists/_explode.scss +15 -13
- data/stylesheets/SassyLists/_first.scss +17 -14
- data/stylesheets/SassyLists/_flatten.scss +16 -12
- data/stylesheets/SassyLists/_has-multiple-values.scss +10 -8
- data/stylesheets/SassyLists/_has-values.scss +9 -8
- data/stylesheets/SassyLists/_insert-nth.scss +16 -15
- data/stylesheets/SassyLists/_intersection.scss +14 -12
- data/stylesheets/SassyLists/_is-empty.scss +14 -10
- data/stylesheets/SassyLists/_is-single.scss +10 -8
- data/stylesheets/SassyLists/_is-symmetrical.scss +16 -12
- data/stylesheets/SassyLists/_last-index.scss +11 -9
- data/stylesheets/SassyLists/_last.scss +14 -12
- data/stylesheets/SassyLists/_loop.scss +21 -17
- data/stylesheets/SassyLists/_prepend.scss +14 -12
- data/stylesheets/SassyLists/_purge.scss +16 -13
- data/stylesheets/SassyLists/_random-value.scss +22 -16
- data/stylesheets/SassyLists/_range.scss +14 -12
- data/stylesheets/SassyLists/_remove-duplicates.scss +16 -12
- data/stylesheets/SassyLists/_remove-nth.scss +17 -13
- data/stylesheets/SassyLists/_remove.scss +18 -14
- data/stylesheets/SassyLists/_replace-nth.scss +18 -16
- data/stylesheets/SassyLists/_replace.scss +16 -14
- data/stylesheets/SassyLists/_reverse.scss +16 -12
- data/stylesheets/SassyLists/_shuffle.scss +16 -12
- data/stylesheets/SassyLists/_slice.scss +18 -16
- data/stylesheets/SassyLists/_some.scss +11 -7
- data/stylesheets/SassyLists/_sort.scss +19 -15
- data/stylesheets/SassyLists/_sum.scss +16 -14
- data/stylesheets/SassyLists/_tail.scss +16 -12
- data/stylesheets/SassyLists/_to-list.scss +15 -15
- data/stylesheets/SassyLists/_to-map.scss +31 -24
- data/stylesheets/SassyLists/_to-string.scss +18 -14
- data/stylesheets/SassyLists/_union.scss +17 -12
- data/stylesheets/SassyLists/_walk.scss +17 -15
- data/stylesheets/SassyLists/helpers/_is-number.scss +10 -8
- data/stylesheets/SassyLists/helpers/_missing-dependencies.scss +10 -8
- data/stylesheets/SassyLists/helpers/_str-compare.scss +12 -10
- data/stylesheets/SassyLists/helpers/_true.scss +10 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01a55bc0fdfbe317688501799cf6f9eb9d139a48
|
4
|
+
data.tar.gz: 9aa64f413e0aadc25d80d190edf36bdf15706549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17560fb770b3445e0b8539aeea201017f65d12a84bc72c7918e526a9b22f1f7f6946bd35d143c1ed21386fcc486ac4fa82dbc3e53b61fba864061207861d528b
|
7
|
+
data.tar.gz: 9fa42d1731305ef8548d8fc83989923d9b6a1fd9d4b09645fc7c10332b2e28a98756dce1ab0b1e894ed5712a1b24adf9b426338200bd0236715d6e019974c094
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SassyLists [](http://badge.fury.io/rb/SassyLists)
|
2
2
|
|
3
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://sassylists.com/).
|
4
4
|
|
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 = "2014-07-
|
18
|
+
VERSION = "2.2.2"
|
19
|
+
DATE = "2014-07-05"
|
20
20
|
end
|
21
21
|
|
@@ -1,16 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
/**
|
2
|
+
* Chunks `$list` into `$size` large lists.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#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
|
+
* @return {List | Null}
|
14
|
+
*/
|
15
|
+
|
14
16
|
@function sl-chunk($list, $size) {
|
15
17
|
@if sl-missing-dependencies(sl-to-list) == true { @return null; }
|
16
18
|
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
/**
|
2
|
+
* Initialize an empty comma-separated list.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-comma-list
|
5
|
+
*
|
6
|
+
* @return {List}
|
7
|
+
*/
|
6
8
|
|
7
9
|
@function sl-comma-list() {
|
8
10
|
@return zip((), ());
|
@@ -1,19 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/**
|
2
|
+
* Returns whether `$list` contains `$value`.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-contain
|
5
|
+
*
|
6
|
+
* @param {List} $list - list to check
|
7
|
+
* @param {*} $value - value to look for
|
8
|
+
*
|
9
|
+
* @return {Bool}
|
10
|
+
*/
|
9
11
|
|
10
12
|
@function sl-contain($list, $value) {
|
11
13
|
@return not not index($list, $value);
|
12
14
|
}
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
/**
|
17
|
+
* @requires sl-contain
|
18
|
+
* @alias sl-contain
|
19
|
+
*/
|
20
|
+
|
17
21
|
@function sl-include($list, $value) {
|
18
22
|
@return sl-contain($list, $value);
|
19
23
|
}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/**
|
2
|
+
* Counts the number of occurrences of each value of `$list`.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-count-values
|
5
|
+
*
|
6
|
+
* @param {List} $list - list to count values from
|
7
|
+
*
|
8
|
+
* @return {Map} Values mapped to their count
|
9
|
+
*/
|
10
|
+
|
9
11
|
@function sl-count-values($list) {
|
10
12
|
$map: ();
|
11
13
|
|
@@ -1,16 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
/**
|
2
|
+
* Returns `$list` as a string, prettified if `$pre` is set to true.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#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
|
+
* @return {String}
|
15
|
+
*/
|
14
16
|
|
15
17
|
@function sl-debug($list, $pre: false, $level: 1) {
|
16
18
|
@if sl-missing-dependencies(sl-is-empty, sl-is-single, sl-has-multiple-values) == true { @return null; }
|
@@ -76,11 +78,13 @@
|
|
76
78
|
@return quote($result);
|
77
79
|
}
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
/**
|
82
|
+
* Mixin displaying clean debug
|
83
|
+
*
|
84
|
+
* @param {List} $list - list
|
85
|
+
*
|
86
|
+
* @requires sl-debug
|
87
|
+
*/
|
84
88
|
|
85
89
|
@mixin sl-debug($list) {
|
86
90
|
body:before {
|
@@ -1,11 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/**
|
2
|
+
* Tests whether all items from `$list` pass the test implemented by `$function`.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#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
|
+
* @return {Bool}
|
11
|
+
*/
|
12
|
+
|
9
13
|
@function sl-every($list, $function, $args...) {
|
10
14
|
@each $item in $list {
|
11
15
|
@if not call($function, $item, $args...) {
|
@@ -1,16 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
/**
|
2
|
+
* Explodes `$string` into a list using `$delimiter` as a delimiter.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#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
|
+
* @return {List | Null}
|
14
|
+
*/
|
15
|
+
|
14
16
|
@function sl-explode($string, $delimiter: '', $separator: "space") {
|
15
17
|
@if type-of($string) != "string" {
|
16
18
|
@warn "`sl-explode` function expecting a string; #{type-of($string)} given.";
|
@@ -1,14 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
/** Returns first element of `$list`.
|
2
|
+
*
|
3
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#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
|
+
* @return {*}
|
12
|
+
*/
|
12
13
|
|
13
14
|
@function sl-first($list) {
|
14
15
|
@if sl-missing-dependencies(sl-is-empty) == true { @return null; }
|
@@ -21,9 +22,11 @@
|
|
21
22
|
@return nth($list, 1);
|
22
23
|
}
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
/**
|
26
|
+
* @requires sl-first
|
27
|
+
* @alias sl-first
|
28
|
+
*/
|
29
|
+
|
27
30
|
@function sl-head($list) {
|
28
31
|
@return sl-first($list);
|
29
32
|
}
|
@@ -1,12 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
/**
|
2
|
+
* Turns multidimensional `$list` into a one-level list.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#flatten
|
5
|
+
*
|
6
|
+
* @param {List} $list - list to flatten
|
7
|
+
*
|
8
|
+
* @requires sl-has-multiple-values
|
9
|
+
*
|
10
|
+
* @return {List}
|
11
|
+
*/
|
10
12
|
|
11
13
|
@function sl-flatten($list) {
|
12
14
|
@if sl-missing-dependencies(sl-has-multiple-values) == true { @return null; }
|
@@ -30,9 +32,11 @@
|
|
30
32
|
@return $result;
|
31
33
|
}
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
+
/**
|
36
|
+
* @requires sl-flatten
|
37
|
+
* @alias sl-flatten
|
38
|
+
*/
|
35
39
|
|
36
40
|
@function sl-unfold($list) {
|
37
|
-
|
41
|
+
@return sl-flatten($list);
|
38
42
|
}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/**
|
2
|
+
* Tests whether `$list` has at least 2 values.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-has-multiple-values
|
5
|
+
*
|
6
|
+
* @param {List} $list - list to run test against
|
7
|
+
*
|
8
|
+
* @return {Bool}
|
9
|
+
*/
|
10
|
+
|
9
11
|
@function sl-has-multiple-values($list) {
|
10
12
|
@return length($list) > 1;
|
11
13
|
}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/** Tests whether `$list` is not empty.
|
2
|
+
*
|
3
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-has-values
|
4
|
+
*
|
5
|
+
* @param {List} $list - list to run test against
|
6
|
+
*
|
7
|
+
* @return {Bool}
|
8
|
+
*/
|
9
|
+
|
9
10
|
@function sl-has-values($list) {
|
10
11
|
@return length($list) > 0;
|
11
12
|
}
|
@@ -1,18 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
/** Adds `$value` at `$index` in `$list`.
|
2
|
+
*
|
3
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-insert-nth
|
4
|
+
*
|
5
|
+
* @requires sl-is-true
|
6
|
+
*
|
7
|
+
* @param {List} $list - list to update
|
8
|
+
* @param {Number} $index - index to add
|
9
|
+
* @param {*} $value - value to add
|
10
|
+
*
|
11
|
+
* @throws List index $index is not a number for `sl-insert-nth`.
|
12
|
+
* @throws List index $index must be a non-zero integer for `sl-insert-nth`.
|
13
|
+
*
|
14
|
+
* @return {List | Null}
|
15
|
+
*/
|
16
|
+
|
16
17
|
@function sl-insert-nth($list, $index, $value) {
|
17
18
|
@if sl-missing-dependencies(sl-is-true) == true { @return null; }
|
18
19
|
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
/**
|
2
|
+
* Returns a list of shared value from `$list` and `$lists` minus duplicates.
|
3
|
+
*
|
4
|
+
* @ignore Documentation: http://sassylists.com/documentation.html#sl-intersection
|
5
|
+
*
|
6
|
+
* @requires sl-remove-duplicates
|
7
|
+
* @requires sl-to-list
|
8
|
+
*
|
9
|
+
* @param {List} $list - first list
|
10
|
+
* @param {ArgList} $lists - other lists
|
11
|
+
*
|
12
|
+
* @return {List}
|
13
|
+
*/
|
14
|
+
|
13
15
|
@function sl-intersection($list, $lists...) {
|
14
16
|
@if sl-missing-dependencies(sl-remove-duplicates) == true { @return null; }
|
15
17
|
|