SassyLists 1.0.0 → 1.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +36 -35
- data/lib/SassyLists.rb +13 -15
- data/stylesheets/SassyLists/_chunk.scss +41 -41
- data/stylesheets/SassyLists/_contain.scss +17 -18
- data/stylesheets/SassyLists/_count-values.scss +18 -18
- data/stylesheets/SassyLists/_debug.scss +96 -94
- data/stylesheets/SassyLists/_explode.scss +49 -48
- data/stylesheets/SassyLists/_first.scss +23 -24
- data/stylesheets/SassyLists/_flatten.scss +35 -36
- data/stylesheets/SassyLists/_insert-nth.scss +46 -45
- data/stylesheets/SassyLists/_intersection.scss +28 -26
- data/stylesheets/SassyLists/_is-symmetrical.scss +18 -19
- data/stylesheets/SassyLists/_last-index.scss +20 -21
- data/stylesheets/SassyLists/_last.scss +17 -24
- data/stylesheets/SassyLists/_loop.scss +35 -36
- data/stylesheets/SassyLists/_prepend.scss +20 -20
- data/stylesheets/SassyLists/_purge.scss +27 -28
- data/stylesheets/SassyLists/_random-value.scss +29 -31
- data/stylesheets/SassyLists/_remove-duplicates.scss +24 -26
- data/stylesheets/SassyLists/_remove-nth.scss +19 -20
- data/stylesheets/SassyLists/_remove.scss +20 -21
- data/stylesheets/SassyLists/_replace-nth.scss +24 -25
- data/stylesheets/SassyLists/_replace.scss +29 -27
- data/stylesheets/SassyLists/_reverse.scss +29 -30
- data/stylesheets/SassyLists/_shuffle.scss +29 -31
- data/stylesheets/SassyLists/_slice.scss +48 -48
- data/stylesheets/SassyLists/_sort.scss +40 -41
- data/stylesheets/SassyLists/_sum.scss +28 -28
- data/stylesheets/SassyLists/_tail.scss +19 -0
- data/stylesheets/SassyLists/_to-string.scss +25 -26
- data/stylesheets/SassyLists/_union.scss +21 -24
- data/stylesheets/SassyLists/_walk.scss +24 -0
- data/stylesheets/SassyLists/helpers/_str-compare.scss +24 -26
- data/stylesheets/SassyLists/helpers/_true.scss +10 -14
- data/stylesheets/_SassyLists.scss +38 -38
- metadata +16 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b2e1d3071bfb06481f5102612d0495a431178ad9
|
4
|
+
data.tar.gz: b1d0c2721ba8f7aa9bf38371b4fecf962ffbd3b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b8273705e9a19ae955d360a9de7e0824100ff152913931920df01fffaa4f8f5e4e8bf689ed83c0ba251ba1ae668cf85a25042ace10bc7826236af832679c3fb
|
7
|
+
data.tar.gz: 768055613e94b9c5ec940e2eac79749722e2285f4a4c9436f920ffe69d4d1036cd00075101103937940eaf4b009b9486607d0c6b7ec999c4d4a7ad9a0c79f958
|
data/CHANGELOG.md
CHANGED
@@ -1,35 +1,36 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
* `1.
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* `0.4.
|
13
|
-
* `0.4.
|
14
|
-
* `0.4.
|
15
|
-
* `0.4.
|
16
|
-
* `0.4.
|
17
|
-
* `0.4.
|
18
|
-
* `0.4.
|
19
|
-
* `0.4.
|
20
|
-
* `0.4.
|
21
|
-
* `0.
|
22
|
-
* `0.3.
|
23
|
-
* `0.3.
|
24
|
-
* `0.3.
|
25
|
-
* `0.3.
|
26
|
-
* `0.3.
|
27
|
-
* `0.
|
28
|
-
* `0.2.
|
29
|
-
* `0.2.
|
30
|
-
* `0.2.
|
31
|
-
* `0.2.
|
32
|
-
* `0.
|
33
|
-
* `0.1.
|
34
|
-
* `0.1.
|
35
|
-
* `0.1.
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
* `1.1.0`: added `walk()` and `tail()`, updated backward loops and fixed broken tests
|
4
|
+
* `1.0.0`: moving code base to Sass 3.3 + adding a Grunt workflow
|
5
|
+
* adding `explode`
|
6
|
+
* making use of `list-separator()` and `set-nth()`
|
7
|
+
* updating `sort()` to make it able to sort strings
|
8
|
+
* removing all notion of recursion for sake of simplicity
|
9
|
+
* making `count-values()` return a map
|
10
|
+
* minor fixes and improvements
|
11
|
+
* improving overall performances
|
12
|
+
* `0.4.9`: removing `compact()` alias for `purge()` (ref [#23](https://github.com/Team-Sass/SassyLists/issues/23))
|
13
|
+
* `0.4.8`: adding `shuffle()`
|
14
|
+
* `0.4.7`: dramatically improving `sort()` performances and removing all its dependencies
|
15
|
+
* `0.4.6`: fixing an issue when passing an empty list to `chunk()` and improved code quality
|
16
|
+
* `0.4.5`: making `sort()` able to return in descending order
|
17
|
+
* `0.4.4`: fixing a typo in `purge()`
|
18
|
+
* `0.4.3`: improving `insert-nth()`, `prepend()`, `replace-nth()` and `replace()` to prevent from adding empty lists
|
19
|
+
* `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
|
20
|
+
* `0.4.1`: improving `intersection()` perf
|
21
|
+
* `0.4.0`: adding `intersection()`
|
22
|
+
* `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
|
23
|
+
* `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
|
24
|
+
* `0.3.3`: removing dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
|
25
|
+
* `0.3.2`: removing dependence to `purge()` from `replace()`
|
26
|
+
* `0.3.1`: adding aliases and cleaned `to-string()`
|
27
|
+
* `0.3.0`: adding `contains()`, `flatten()`, `union()`
|
28
|
+
* `0.2.4`: improving `debug()`
|
29
|
+
* `0.2.3`: fixing important issues with comments
|
30
|
+
* `0.2.2`: moving all comments to invisible
|
31
|
+
* `0.2.1`: fixing an issue with `random-value()`
|
32
|
+
* `0.2.0`: adding `random-value()`
|
33
|
+
* `0.1.4`: fixing an issue with `sort()`, `is-symmetrical()`
|
34
|
+
* `0.1.3`: fixing an issue with `sort()`
|
35
|
+
* `0.1.2`: improving `debug()`
|
36
|
+
* `0.1.1`: initial commit
|
data/lib/SassyLists.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
require 'compass'
|
2
|
-
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
3
|
-
Compass::Frameworks.register('SassyLists', :path => extension_path)
|
4
|
-
|
5
|
-
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
6
|
-
# Date is in the form of YYYY-MM-DD
|
7
|
-
module SassyLists
|
8
|
-
VERSION = "1.
|
9
|
-
DATE = "2014-
|
10
|
-
end
|
11
|
-
|
12
|
-
module Sass::Script::Functions
|
13
|
-
|
14
|
-
Sass::Script::Number.new(rand(max.value), max.numerator_units, max.denominator_units)
|
15
|
-
end
|
1
|
+
require 'compass'
|
2
|
+
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
3
|
+
Compass::Frameworks.register('SassyLists', :path => extension_path)
|
4
|
+
|
5
|
+
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
6
|
+
# Date is in the form of YYYY-MM-DD
|
7
|
+
module SassyLists
|
8
|
+
VERSION = "1.1.0"
|
9
|
+
DATE = "2014-06-28"
|
10
|
+
end
|
11
|
+
|
12
|
+
module Sass::Script::Functions
|
13
|
+
|
16
14
|
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
// Chunks $list into $size large lists
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @param $list
|
6
|
-
// @param $size
|
7
|
-
//
|
8
|
-
// @
|
9
|
-
//
|
10
|
-
// @return
|
11
|
-
|
12
|
-
@function chunk($list, $size) {
|
13
|
-
@if type-of($size) != "number" {
|
14
|
-
@warn "#{$size} is not a number for `chunk`.";
|
15
|
-
@return false;
|
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/#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 `chunk`.
|
9
|
+
//
|
10
|
+
// @return {List | Bool}
|
11
|
+
|
12
|
+
@function chunk($list, $size) {
|
13
|
+
@if type-of($size) != "number" {
|
14
|
+
@warn "#{$size} is not a number for `chunk`.";
|
15
|
+
@return false;
|
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
|
}
|
@@ -1,19 +1,18 @@
|
|
1
|
-
// Returns whether $list contains $value
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @
|
6
|
-
//
|
7
|
-
//
|
8
|
-
// @
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
@
|
18
|
-
@return contain($list, $value);
|
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 contain($list, $value) {
|
11
|
+
@return not not index($list, $value);
|
12
|
+
}
|
13
|
+
|
14
|
+
// @alias contain
|
15
|
+
|
16
|
+
@function include($list, $value) {
|
17
|
+
@return contain($list, $value);
|
19
18
|
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
// Counts the number of occurrences of each value of $list
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @param $list
|
6
|
-
//
|
7
|
-
// @return
|
8
|
-
|
9
|
-
@function 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/#count-values
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to count values from
|
6
|
+
//
|
7
|
+
// @return {Map} Values mapped to their count
|
8
|
+
|
9
|
+
@function 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
|
}
|
@@ -1,94 +1,96 @@
|
|
1
|
-
// Returns $list as a string
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @param $list
|
6
|
-
// @param $pre
|
7
|
-
// @param $level
|
8
|
-
//
|
9
|
-
// @return
|
10
|
-
|
11
|
-
@function debug($list, $pre: false, $level: 1) {
|
12
|
-
@if length($list) == 0 {
|
13
|
-
@return "( )";
|
14
|
-
}
|
15
|
-
|
16
|
-
@if length($list) == 1 {
|
17
|
-
@return if($pre, "(" + type-of($list) + ") ", "") + $list;
|
18
|
-
}
|
19
|
-
|
20
|
-
$tab: " ";
|
21
|
-
$indent: "";
|
22
|
-
$break: if($pre, "\A ", "");
|
23
|
-
$length: length($list);
|
24
|
-
|
25
|
-
@for $i from 1 to $level {
|
26
|
-
$indent: $indent + $tab;
|
27
|
-
}
|
28
|
-
|
29
|
-
$result: "[" + $break;
|
30
|
-
|
31
|
-
@for $i from 1 through $length {
|
32
|
-
$item: nth($list, $i);
|
33
|
-
$result: $result + if($pre, $indent + $tab, " ");
|
34
|
-
|
35
|
-
@if length($item) > 1 {
|
36
|
-
$result: $result
|
37
|
-
+ if($pre, "(list: " + length($item) + ") ", "")
|
38
|
-
+ debug($item, $pre, $level + 1);
|
39
|
-
}
|
40
|
-
|
41
|
-
@else {
|
42
|
-
@if $pre {
|
43
|
-
$result: $result + "(" + type-of($item) + ") ";
|
44
|
-
}
|
45
|
-
|
46
|
-
@if length($item) == 0 {
|
47
|
-
$result: $result + "( )";
|
48
|
-
}
|
49
|
-
|
50
|
-
@else if type-of($item) == "string" {
|
51
|
-
$result: $result + quote($item);
|
52
|
-
}
|
53
|
-
|
54
|
-
@else if $item == null {
|
55
|
-
$result: $result + "null";
|
56
|
-
}
|
57
|
-
|
58
|
-
@else {
|
59
|
-
$result: $result + $item;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
@if $i != $length {
|
64
|
-
$result: $result + "," + $break;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
$result: $result + $break + if($pre, if($level > 1, $indent, ""), " ") + "]";
|
69
|
-
|
70
|
-
@return quote($result);
|
71
|
-
}
|
72
|
-
|
73
|
-
// Mixin displaying clean debug
|
74
|
-
//
|
75
|
-
// @param $list
|
76
|
-
|
77
|
-
@
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
1
|
+
// Returns $list as a string
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#debug
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to debug
|
6
|
+
// @param {Bool} $pre (false) - enable/disable variables type and proper indentation
|
7
|
+
// @param {Number} $level (1) - internal variable for recursion
|
8
|
+
//
|
9
|
+
// @return {String}
|
10
|
+
|
11
|
+
@function debug($list, $pre: false, $level: 1) {
|
12
|
+
@if length($list) == 0 {
|
13
|
+
@return "( )";
|
14
|
+
}
|
15
|
+
|
16
|
+
@if length($list) == 1 {
|
17
|
+
@return if($pre, "(" + type-of($list) + ") ", "") + $list;
|
18
|
+
}
|
19
|
+
|
20
|
+
$tab: " ";
|
21
|
+
$indent: "";
|
22
|
+
$break: if($pre, "\A ", "");
|
23
|
+
$length: length($list);
|
24
|
+
|
25
|
+
@for $i from 1 to $level {
|
26
|
+
$indent: $indent + $tab;
|
27
|
+
}
|
28
|
+
|
29
|
+
$result: "[" + $break;
|
30
|
+
|
31
|
+
@for $i from 1 through $length {
|
32
|
+
$item: nth($list, $i);
|
33
|
+
$result: $result + if($pre, $indent + $tab, " ");
|
34
|
+
|
35
|
+
@if length($item) > 1 {
|
36
|
+
$result: $result
|
37
|
+
+ if($pre, "(list: " + length($item) + ") ", "")
|
38
|
+
+ debug($item, $pre, $level + 1);
|
39
|
+
}
|
40
|
+
|
41
|
+
@else {
|
42
|
+
@if $pre {
|
43
|
+
$result: $result + "(" + type-of($item) + ") ";
|
44
|
+
}
|
45
|
+
|
46
|
+
@if length($item) == 0 {
|
47
|
+
$result: $result + "( )";
|
48
|
+
}
|
49
|
+
|
50
|
+
@else if type-of($item) == "string" {
|
51
|
+
$result: $result + quote($item);
|
52
|
+
}
|
53
|
+
|
54
|
+
@else if $item == null {
|
55
|
+
$result: $result + "null";
|
56
|
+
}
|
57
|
+
|
58
|
+
@else {
|
59
|
+
$result: $result + $item;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
@if $i != $length {
|
64
|
+
$result: $result + "," + $break;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
$result: $result + $break + if($pre, if($level > 1, $indent, ""), " ") + "]";
|
69
|
+
|
70
|
+
@return quote($result);
|
71
|
+
}
|
72
|
+
|
73
|
+
// Mixin displaying clean debug
|
74
|
+
//
|
75
|
+
// @param {List} $list - list
|
76
|
+
//
|
77
|
+
// @requires {function} debug
|
78
|
+
|
79
|
+
@mixin debug($list) {
|
80
|
+
body:before {
|
81
|
+
content: debug($list, true) !important;
|
82
|
+
|
83
|
+
display: block !important;
|
84
|
+
margin: 1em !important;
|
85
|
+
padding: .5em !important;
|
86
|
+
|
87
|
+
background: #EFEFEF !important;
|
88
|
+
border: 1px solid #DDD !important;
|
89
|
+
border-radius: .2em !important;
|
90
|
+
|
91
|
+
color: #333 !important;
|
92
|
+
font: .75em/1.5 "Courier New", monospace !important;
|
93
|
+
text-shadow: 0 1px white !important;
|
94
|
+
white-space: pre-wrap !important;
|
95
|
+
}
|
96
|
+
}
|
@@ -1,49 +1,50 @@
|
|
1
|
-
// Explode $string into a list using $break as a breaker
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @param $string
|
6
|
-
// @param $separator
|
7
|
-
//
|
8
|
-
// @
|
9
|
-
//
|
10
|
-
//
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
$
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
$
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
$
|
44
|
-
$
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
1
|
+
// Explode $string into a list using $break as a breaker
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#explode
|
4
|
+
//
|
5
|
+
// @param {String} $string - string to explode
|
6
|
+
// @param {String} $separator ('') - string to use as a delimiter
|
7
|
+
//
|
8
|
+
// @throws $string is not a string for `explode`.
|
9
|
+
// @throws $delimiter is not a string for `explode`.
|
10
|
+
//
|
11
|
+
// @return {List | Bool}
|
12
|
+
|
13
|
+
@function explode($string, $delimiter: '') {
|
14
|
+
@if type-of($string) != "string" {
|
15
|
+
@warn "`explode` function expecting a string; #{type-of($string)} given.";
|
16
|
+
@return false;
|
17
|
+
}
|
18
|
+
|
19
|
+
@if type-of($delimiter) != "string" {
|
20
|
+
@warn "`explode` function expecting a string; #{type-of($delimiter)} given.";
|
21
|
+
@return false;
|
22
|
+
}
|
23
|
+
|
24
|
+
$result: ();
|
25
|
+
$length: str-length($string);
|
26
|
+
|
27
|
+
@if str-length($delimiter) == 0 {
|
28
|
+
@for $i from 1 through $length {
|
29
|
+
$result: append($result, str-slice($string, $i, $i));
|
30
|
+
}
|
31
|
+
@return $result;
|
32
|
+
}
|
33
|
+
|
34
|
+
$running: true;
|
35
|
+
$remaining: $string;
|
36
|
+
|
37
|
+
@while $running {
|
38
|
+
$index: str-index($remaining, $delimiter);
|
39
|
+
@if not $index or $index == 0 {
|
40
|
+
$running: false;
|
41
|
+
}
|
42
|
+
@else {
|
43
|
+
$slice: str-slice($remaining, 1, $index - 1);
|
44
|
+
$result: append($result, $slice);
|
45
|
+
$remaining: str-slice($remaining, $index + str-length($delimiter));
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
@return append($result, $remaining);
|
49
50
|
}
|
@@ -1,25 +1,24 @@
|
|
1
|
-
// Returns first element of $list
|
2
|
-
//
|
3
|
-
// @
|
4
|
-
//
|
5
|
-
// @
|
6
|
-
//
|
7
|
-
// @
|
8
|
-
//
|
9
|
-
// @
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@
|
24
|
-
@return first($list);
|
1
|
+
// Returns first element of $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#first
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to retrieve first item from
|
6
|
+
//
|
7
|
+
// @throws Cannot find first item of empty list.
|
8
|
+
//
|
9
|
+
// @return {*}
|
10
|
+
|
11
|
+
@function first($list) {
|
12
|
+
@if length($list) == 0 {
|
13
|
+
@warn "Cannot find first item of empty list.";
|
14
|
+
@return false;
|
15
|
+
}
|
16
|
+
|
17
|
+
@return nth($list, 1);
|
18
|
+
}
|
19
|
+
|
20
|
+
// @alias first
|
21
|
+
|
22
|
+
@function head($list) {
|
23
|
+
@return first($list);
|
25
24
|
}
|