SassyLists 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -43
  3. data/README.md +73 -73
  4. data/lib/SassyLists.rb +21 -21
  5. data/stylesheets/SassyLists/_chunk.scss +41 -41
  6. data/stylesheets/SassyLists/_comma-list.scss +9 -0
  7. data/stylesheets/SassyLists/_contain.scss +17 -17
  8. data/stylesheets/SassyLists/_count-values.scss +18 -18
  9. data/stylesheets/SassyLists/_debug.scss +96 -96
  10. data/stylesheets/SassyLists/_every.scss +17 -17
  11. data/stylesheets/SassyLists/_explode.scss +52 -52
  12. data/stylesheets/SassyLists/_first.scss +23 -23
  13. data/stylesheets/SassyLists/_flatten.scss +35 -35
  14. data/stylesheets/SassyLists/_insert-nth.scss +48 -48
  15. data/stylesheets/SassyLists/_intersection.scss +30 -30
  16. data/stylesheets/SassyLists/_is-empty.scss +18 -0
  17. data/stylesheets/SassyLists/_is-symmetrical.scss +20 -20
  18. data/stylesheets/SassyLists/_last-index.scss +20 -20
  19. data/stylesheets/SassyLists/_last.scss +17 -17
  20. data/stylesheets/SassyLists/_loop.scss +37 -37
  21. data/stylesheets/SassyLists/_prepend.scss +22 -22
  22. data/stylesheets/SassyLists/_purge.scss +29 -29
  23. data/stylesheets/SassyLists/_random-value.scss +29 -29
  24. data/stylesheets/SassyLists/_remove-duplicates.scss +24 -24
  25. data/stylesheets/SassyLists/_remove-nth.scss +21 -21
  26. data/stylesheets/SassyLists/_remove.scss +22 -22
  27. data/stylesheets/SassyLists/_replace-nth.scss +26 -26
  28. data/stylesheets/SassyLists/_replace.scss +32 -32
  29. data/stylesheets/SassyLists/_reverse.scss +29 -29
  30. data/stylesheets/SassyLists/_shuffle.scss +30 -30
  31. data/stylesheets/SassyLists/_slice.scss +53 -53
  32. data/stylesheets/SassyLists/_some.scss +17 -17
  33. data/stylesheets/SassyLists/_sort.scss +42 -42
  34. data/stylesheets/SassyLists/_sum.scss +28 -28
  35. data/stylesheets/SassyLists/_tail.scss +20 -20
  36. data/stylesheets/SassyLists/_to-list.scss +18 -0
  37. data/stylesheets/SassyLists/_to-map.scss +50 -50
  38. data/stylesheets/SassyLists/_to-string.scss +25 -25
  39. data/stylesheets/SassyLists/_union.scss +24 -24
  40. data/stylesheets/SassyLists/_walk.scss +23 -23
  41. data/stylesheets/SassyLists/helpers/_missing-dependencies.scss +22 -22
  42. data/stylesheets/SassyLists/helpers/_str-compare.scss +27 -27
  43. data/stylesheets/SassyLists/helpers/_true.scss +10 -10
  44. data/stylesheets/_SassyLists.scss +45 -42
  45. metadata +8 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a296e7541de900b0667d9adc5982680695baf408
4
- data.tar.gz: cfe6a3f3016520920a2109556c0315bef0fa0f59
3
+ metadata.gz: 08fe82b4659c4fbab4ee92f4b86801a4d794e103
4
+ data.tar.gz: 4ac22e42947a48ac6a4214931410c5ae6e4bbb5f
5
5
  SHA512:
6
- metadata.gz: 130887373e83c97df31b98774bc78f8becd565fedbe99b2cb29278938ea0b1b7b95bbbda4038aded18c2881bc3c9ceea66d1ec6431e1c9d8580475867b4193dd
7
- data.tar.gz: c832a9b26caee25bae587bf9519fd3b0d1a49d8256ec4c88837f24e7dcee0e1ecc40f210449ccb90628e4a1e364467cbe78ef6c2973c4e19c7554f48f45397cb
6
+ metadata.gz: e64638ebc69f93b974b9b87e82d1a2f9177cf80b2a03a37754a922946fc05e104fefeec907e439ef3774c064737b2b6198f5359c1a35d34cc2beb498314e5de3
7
+ data.tar.gz: 24344e3fe3ce0809bed78b2c7e29c26ed6a71223b843e53ebbdd479a8bd2bcd4a22232202b1a0dc95d1dd190f3fe1dc3bf3deeffbec5f792809a5d4a606241b0
data/CHANGELOG.md CHANGED
@@ -1,43 +1,44 @@
1
- # Changelog
2
-
3
- * `2.0.0`:
4
- * adding `to-map()`, `every()` and `some()`
5
- * adding and improved tests
6
- * prefixing all functions with `sl-`
7
- * fixing an issue with `random-value()` sometimes failing
8
- * changing all `false` returns into `null` in case of error
9
- * removing Compass dependency
10
- * `1.1.0`: adding `walk()` and `tail()`, updated backward loops and fixed broken tests
11
- * `1.0.0`: moving code base to Sass 3.3 + adding a Grunt workflow
12
- * adding `explode`
13
- * making use of `list-separator()` and `set-nth()`
14
- * updating `sort()` to make it able to sort strings
15
- * removing all notion of recursion for sake of simplicity
16
- * making `count-values()` return a map
17
- * minor fixes and improvements
18
- * improving overall performances
19
- * `0.4.9`: removing `compact()` alias for `purge()` (ref [#23](https://github.com/Team-Sass/SassyLists/issues/23))
20
- * `0.4.8`: adding `shuffle()`
21
- * `0.4.7`: dramatically improving `sort()` performances and removing all its dependencies
22
- * `0.4.6`: fixing an issue when passing an empty list to `chunk()` and improved code quality
23
- * `0.4.5`: making `sort()` able to return in descending order
24
- * `0.4.4`: fixing a typo in `purge()`
25
- * `0.4.3`: improving `insert-nth()`, `prepend()`, `replace-nth()` and `replace()` to prevent from adding empty lists
26
- * `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
27
- * `0.4.1`: improving `intersection()` perf
28
- * `0.4.0`: adding `intersection()`
29
- * `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
30
- * `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
31
- * `0.3.3`: removing dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
32
- * `0.3.2`: removing dependence to `purge()` from `replace()`
33
- * `0.3.1`: adding aliases and cleaned `to-string()`
34
- * `0.3.0`: adding `contains()`, `flatten()`, `union()`
35
- * `0.2.4`: improving `debug()`
36
- * `0.2.3`: fixing important issues with comments
37
- * `0.2.2`: moving all comments to invisible
38
- * `0.2.1`: fixing an issue with `random-value()`
39
- * `0.2.0`: adding `random-value()`
40
- * `0.1.4`: fixing an issue with `sort()`, `is-symmetrical()`
41
- * `0.1.3`: fixing an issue with `sort()`
42
- * `0.1.2`: improving `debug()`
43
- * `0.1.1`: initial commit
1
+ # Changelog
2
+
3
+ * `2.1.0`: adding `sl-is-empty()`, `sl-to-list()` and `sl-comma-list()`
4
+ * `2.0.0`:
5
+ * adding `sl-to-map()`, `sl-every()` and `sl-some()`
6
+ * adding and improved tests
7
+ * prefixing all functions with `sl-`
8
+ * fixing an issue with `random-value()` sometimes failing
9
+ * changing all `false` returns into `null` in case of error
10
+ * removing Compass dependency
11
+ * `1.1.0`: adding `walk()` and `tail()`, updated backward loops and fixed broken tests
12
+ * `1.0.0`: moving code base to Sass 3.3 + adding a Grunt workflow
13
+ * adding `explode`
14
+ * making use of `list-separator()` and `set-nth()`
15
+ * updating `sort()` to make it able to sort strings
16
+ * removing all notion of recursion for sake of simplicity
17
+ * making `count-values()` return a map
18
+ * minor fixes and improvements
19
+ * improving overall performances
20
+ * `0.4.9`: removing `compact()` alias for `purge()` (ref [#23](https://github.com/Team-Sass/SassyLists/issues/23))
21
+ * `0.4.8`: adding `shuffle()`
22
+ * `0.4.7`: dramatically improving `sort()` performances and removing all its dependencies
23
+ * `0.4.6`: fixing an issue when passing an empty list to `chunk()` and improved code quality
24
+ * `0.4.5`: making `sort()` able to return in descending order
25
+ * `0.4.4`: fixing a typo in `purge()`
26
+ * `0.4.3`: improving `insert-nth()`, `prepend()`, `replace-nth()` and `replace()` to prevent from adding empty lists
27
+ * `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
28
+ * `0.4.1`: improving `intersection()` perf
29
+ * `0.4.0`: adding `intersection()`
30
+ * `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
31
+ * `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
32
+ * `0.3.3`: removing dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
33
+ * `0.3.2`: removing dependence to `purge()` from `replace()`
34
+ * `0.3.1`: adding aliases and cleaned `to-string()`
35
+ * `0.3.0`: adding `contains()`, `flatten()`, `union()`
36
+ * `0.2.4`: improving `debug()`
37
+ * `0.2.3`: fixing important issues with comments
38
+ * `0.2.2`: moving all comments to invisible
39
+ * `0.2.1`: fixing an issue with `random-value()`
40
+ * `0.2.0`: adding `random-value()`
41
+ * `0.1.4`: fixing an issue with `sort()`, `is-symmetrical()`
42
+ * `0.1.3`: fixing an issue with `sort()`
43
+ * `0.1.2`: improving `debug()`
44
+ * `0.1.1`: initial commit
data/README.md CHANGED
@@ -1,73 +1,73 @@
1
- # SassyLists [![Gem Version](https://badge.fury.io/rb/SassyLists.png)](http://badge.fury.io/rb/SassyLists)
2
-
3
- Here is a [Compass Extension](http://compass-style.org/) providing you all functions you need to manipulate your [Sass](http://sass-lang.com/) lists. See complete documentation [here](http://sassylists.com/).
4
-
5
- ## How to use it
6
-
7
- ### Install with Gem
8
-
9
- 1. `gem install SassyLists`
10
- 2. Add `require 'SassyLists'` to your `config.rb`
11
- 3. Import it in your stylesheets with `@import 'SassyLists'`
12
-
13
- ### Install with [Bower](http://bower.io/ "BOWER: A package manager for the web")
14
- 1. `bower install SassyLists --save-dev`
15
- 2. Import the partial in your Sass files
16
-
17
- ## What's in there?
18
-
19
- * `sl-chunk()`: returns whether list contains $value
20
- * `sl-contain()`: returns whether the list contains the value
21
- * `sl-count-values()`: counts the number of occurrences of each value of list
22
- * `sl-debug()`: returns list as a string
23
- * `sl-every()`: returns whether all items from list pass test from given function
24
- * `sl-explode()`: explodes a string into a list using a string as a delimiter
25
- * `sl-first()`: returns first item in list
26
- * `sl-flatten()`: turns multidimensional list into a one-level list
27
- * `sl-insert-nth()`: inserts value at index
28
- * `sl-intersection()`: returns a list of shared values across all given lists
29
- * `sl-is-symmetrical()`: checks if list is symmetrical
30
- * `sl-last()`: returns last item in list
31
- * `sl-last-index()`: returns last index of value in list
32
- * `sl-loop()`: shifts indexes in list
33
- * `sl-prepend()`: prepends value to list
34
- * `sl-purge()`: removes all `false` and `null` values from list
35
- * `sl-random-value()`: returns random value from list
36
- * `sl-remove()`: removes value in list
37
- * `sl-remove-duplicates()`: removes duplicate values from list
38
- * `sl-remove-nth()`: removes value at index
39
- * `sl-replace()`: replaces value in list
40
- * `sl-replace-nth()`: replaces value at index
41
- * `sl-reverse()`: reverses list
42
- * `sl-shuffle()`: shuffles list
43
- * `sl-slice()`: slices list
44
- * `sl-sort()`: sorts list
45
- * `sl-some()`: returns whether some items from list pass test from given function
46
- * `sl-sum()`: sums all unitless values in list
47
- * `sl-tail()`: returns anything but the first element in list
48
- * `sl-to-map()`: casts list as map using indexes as keys
49
- * `sl-to-string()`: casts list as string (JS `.join()`)
50
- * `sl-union()`: returns a list of values from given lists minus duplicates
51
- * `sl-walk()`: applies a function to every item of list
52
-
53
- If you feel like an explorer, you can have a look at the code [here](https://github.com/Team-Sass/SassyLists/tree/master/stylesheets).
54
-
55
- ## Requirements
56
-
57
- * Sass ~> 3.3.0
58
- * Compass ~> 1.0.0
59
-
60
- If you are looking for the last version of SassyLists running on Sass 3.2, install `0.4.9`.
61
-
62
- Some functions depend on other functions. If you include functions individually, make sure to check for these dependencies in their respective docs.
63
-
64
- ## Also read
65
-
66
- * [Official site](http://sassylists.com)
67
- * [Advanced Sass list functions](http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/)
68
- * [Advanced Sass list functions again](http://hugogiraudel.com/2013/10/09/advanced-sass-list-functions-again/)
69
- * [How I made a Sass debug function](http://hugogiraudel.com/2013/10/21/sass-debug/)
70
-
71
- ## Credits
72
-
73
- A million thanks to [Vinay Raghu](http://viii.in/) for making this Compass extension out of my original work and to [Team-Sass](https://github.com/Team-Sass) for their [Compass Extension template](https://github.com/Team-Sass/Compass-Extension-Template).
1
+ # SassyLists [![Gem Version](https://badge.fury.io/rb/SassyLists.png)](http://badge.fury.io/rb/SassyLists)
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://sassylists.com/).
4
+
5
+ ## How to use it
6
+
7
+ ### Install with Gem
8
+
9
+ 1. `gem install SassyLists`
10
+
11
+ ### Install with [Bower](http://bower.io/ "BOWER: A package manager for the web")
12
+ 1. `bower install SassyLists --save-dev`
13
+ 2. Import the partial in your Sass files
14
+
15
+ ## What's in there?
16
+
17
+ * `sl-chunk()`: returns whether list contains $value
18
+ * `sl-comma-list()`: initializes an empty comma-separated list
19
+ * `sl-contain()`: returns whether the list contains the value
20
+ * `sl-count-values()`: counts the number of occurrences of each value of list
21
+ * `sl-debug()`: returns list as a string
22
+ * `sl-every()`: returns whether all items from list pass test from given function
23
+ * `sl-explode()`: explodes a string into a list using a string as a delimiter
24
+ * `sl-first()`: returns first item in list
25
+ * `sl-flatten()`: turns multidimensional list into a one-level list
26
+ * `sl-insert-nth()`: inserts value at index
27
+ * `sl-intersection()`: returns a list of shared values across all given lists
28
+ * `sl-is-empty()`: checks if list is empty
29
+ * `sl-is-symmetrical()`: checks if list is symmetrical
30
+ * `sl-last()`: returns last item in list
31
+ * `sl-last-index()`: returns last index of value in list
32
+ * `sl-loop()`: shifts indexes in list
33
+ * `sl-prepend()`: prepends value to list
34
+ * `sl-purge()`: removes all `false` and `null` values from list
35
+ * `sl-random-value()`: returns random value from list
36
+ * `sl-remove()`: removes value in list
37
+ * `sl-remove-duplicates()`: removes duplicate values from list
38
+ * `sl-remove-nth()`: removes value at index
39
+ * `sl-replace()`: replaces value in list
40
+ * `sl-replace-nth()`: replaces value at index
41
+ * `sl-reverse()`: reverses list
42
+ * `sl-shuffle()`: shuffles list
43
+ * `sl-slice()`: slices list
44
+ * `sl-sort()`: sorts list
45
+ * `sl-some()`: returns whether some items from list pass test from given function
46
+ * `sl-sum()`: sums all unitless values in list
47
+ * `sl-tail()`: returns anything but the first element in list
48
+ * `sl-to-list()`: casts value as list
49
+ * `sl-to-map()`: casts list as map using indexes as keys
50
+ * `sl-to-string()`: casts list as string (JS `.join()`)
51
+ * `sl-union()`: returns a list of values from given lists minus duplicates
52
+ * `sl-walk()`: applies a function to every item of list
53
+
54
+ If you feel like an explorer, you can have a look at the code [here](https://github.com/Team-Sass/SassyLists/tree/master/stylesheets).
55
+
56
+ ## Requirements
57
+
58
+ * Sass ~> 3.3
59
+
60
+ If you are looking for the last version of SassyLists running on Sass 3.2, install `0.4.9`.
61
+
62
+ Some functions depend on other functions. If you include functions individually, make sure to check for these dependencies in their respective docs.
63
+
64
+ ## Also read
65
+
66
+ * [Official site](http://sassylists.com)
67
+ * [Advanced Sass list functions](http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/)
68
+ * [Advanced Sass list functions again](http://hugogiraudel.com/2013/10/09/advanced-sass-list-functions-again/)
69
+ * [How I made a Sass debug function](http://hugogiraudel.com/2013/10/21/sass-debug/)
70
+
71
+ ## Credits
72
+
73
+ A lot of thanks to all contributors and to [Team-Sass](https://github.com/Team-Sass) for their support.
data/lib/SassyLists.rb CHANGED
@@ -1,21 +1,21 @@
1
- extension_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
- stylesheets_path = File.join(extension_path, 'stylesheets')
3
-
4
- if (defined? Compass)
5
- Compass::Frameworks.register('SassyLists', :path => extension_path)
6
- else
7
- # compass not found, register on the Sass path via the environment.
8
- if ENV.has_key?("SASS_PATH")
9
- ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + stylesheets_path
10
- else
11
- ENV["SASS_PATH"] = stylesheets_path
12
- end
13
- end
14
-
15
- # Version is a number. If a version contains alphas, it will be created as a prerelease version
16
- # Date is in the form of YYYY-MM-DD
17
- module SassyLists
18
- VERSION = "2.0.0"
19
- DATE = "2014-06-30"
20
- end
21
-
1
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
+ stylesheets_path = File.join(extension_path, 'stylesheets')
3
+
4
+ if (defined? Compass)
5
+ Compass::Frameworks.register('SassyLists', :path => extension_path)
6
+ else
7
+ # compass not found, register on the Sass path via the environment.
8
+ if ENV.has_key?("SASS_PATH")
9
+ ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + stylesheets_path
10
+ else
11
+ ENV["SASS_PATH"] = stylesheets_path
12
+ end
13
+ end
14
+
15
+ # Version is a number. If a version contains alphas, it will be created as a prerelease version
16
+ # Date is in the form of YYYY-MM-DD
17
+ module SassyLists
18
+ VERSION = "2.1.0"
19
+ DATE = "2014-07-01"
20
+ end
21
+
@@ -1,42 +1,42 @@
1
- // Chunks `$list` into `$size` large lists.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation/#chunk
4
- //
5
- // @param {List} $list - list to chunk
6
- // @param {Number} $size - length of lists
7
- //
8
- // @throws $size is not a number for `sl-chunk`.
9
- //
10
- // @return {List | Null}
11
-
12
- @function sl-chunk($list, $size) {
13
- @if type-of($size) != "number" {
14
- @warn "#{$size} is not a number for `sl-chunk`.";
15
- @return null;
16
- }
17
-
18
- @if $size >= length($list) {
19
- @return $list;
20
- }
21
-
22
- $index: 1;
23
- $result: ();
24
- $length: length($list);
25
- $end: ceil($length / $size);
26
-
27
- @for $i from 1 through $end {
28
- $tmp: ();
29
-
30
- @for $j from 1 through $size {
31
- @if $index <= $length {
32
- $is-orphan: $length % $size == 1 and $j == 1;
33
- $tmp: if($is-orphan, nth($list, $index), append($tmp, nth($list, $index)));
34
- }
35
- $index: $index + 1;
36
- }
37
-
38
- $result: append($result, $tmp);
39
- }
40
-
41
- @return $result;
1
+ // Chunks `$list` into `$size` large lists.
2
+ //
3
+ // @ignore Documentation: http://sassylists.com/documentation.html#sl-chunk
4
+ //
5
+ // @param {List} $list - list to chunk
6
+ // @param {Number} $size - length of lists
7
+ //
8
+ // @throws $size is not a number for `sl-chunk`.
9
+ //
10
+ // @return {List | Null}
11
+
12
+ @function sl-chunk($list, $size) {
13
+ @if type-of($size) != "number" {
14
+ @warn "#{$size} is not a number for `sl-chunk`.";
15
+ @return null;
16
+ }
17
+
18
+ @if $size >= length($list) {
19
+ @return $list;
20
+ }
21
+
22
+ $index: 1;
23
+ $result: ();
24
+ $length: length($list);
25
+ $end: ceil($length / $size);
26
+
27
+ @for $i from 1 through $end {
28
+ $tmp: ();
29
+
30
+ @for $j from 1 through $size {
31
+ @if $index <= $length {
32
+ $is-orphan: $length % $size == 1 and $j == 1;
33
+ $tmp: if($is-orphan, nth($list, $index), append($tmp, nth($list, $index)));
34
+ }
35
+ $index: $index + 1;
36
+ }
37
+
38
+ $result: append($result, $tmp);
39
+ }
40
+
41
+ @return $result;
42
42
  }
@@ -0,0 +1,9 @@
1
+ // Initialize an empty comma-separated list.
2
+ //
3
+ // @ignore Documentation: http://sassylists.com/documentation.html#sl-comma-list
4
+ //
5
+ // @return {List}
6
+
7
+ @function sl-comma-list() {
8
+ @return zip((), ());
9
+ }
@@ -1,18 +1,18 @@
1
- // Returns whether `$list` contains `$value`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation/#contain
4
- //
5
- // @param {List} $list - list to check
6
- // @param {*} $value - value to look for
7
- //
8
- // @return {Bool}
9
-
10
- @function sl-contain($list, $value) {
11
- @return not not index($list, $value);
12
- }
13
-
14
- // @alias sl-contain
15
-
16
- @function sl-include($list, $value) {
17
- @return sl-contain($list, $value);
1
+ // Returns whether `$list` contains `$value`.
2
+ //
3
+ // @ignore Documentation: http://sassylists.com/documentation.html#sl-contain
4
+ //
5
+ // @param {List} $list - list to check
6
+ // @param {*} $value - value to look for
7
+ //
8
+ // @return {Bool}
9
+
10
+ @function sl-contain($list, $value) {
11
+ @return not not index($list, $value);
12
+ }
13
+
14
+ // @alias sl-contain
15
+
16
+ @function sl-include($list, $value) {
17
+ @return sl-contain($list, $value);
18
18
  }
@@ -1,19 +1,19 @@
1
- // Counts the number of occurrences of each value of `$list`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation/#count-values
4
- //
5
- // @param {List} $list - list to count values from
6
- //
7
- // @return {Map} Values mapped to their count
8
-
9
- @function sl-count-values($list) {
10
- $map: ();
11
-
12
- @each $item in $list {
13
- $index: map-get($map, $item);
14
- $value: if($index, $index + 1, 1);
15
- $map: map-merge($map, ($item: $value));
16
- }
17
-
18
- @return $map;
1
+ // Counts the number of occurrences of each value of `$list`.
2
+ //
3
+ // @ignore Documentation: http://sassylists.com/documentation.html#sl-count-values
4
+ //
5
+ // @param {List} $list - list to count values from
6
+ //
7
+ // @return {Map} Values mapped to their count
8
+
9
+ @function sl-count-values($list) {
10
+ $map: ();
11
+
12
+ @each $item in $list {
13
+ $index: map-get($map, $item);
14
+ $value: if($index, $index + 1, 1);
15
+ $map: map-merge($map, ($item: $value));
16
+ }
17
+
18
+ @return $map;
19
19
  }