SassyLists 0.4.1 → 0.4.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.
- data/CHANGELOG.md +6 -5
- data/lib/SassyLists.rb +2 -2
- data/stylesheets/SassyLists/_contain.scss +2 -2
- data/stylesheets/SassyLists/_first.scss +8 -1
- data/stylesheets/SassyLists/_insert-nth.scss +4 -3
- data/stylesheets/SassyLists/_is-symmetrical.scss +3 -2
- data/stylesheets/SassyLists/_last-index.scss +8 -7
- data/stylesheets/SassyLists/_last.scss +8 -1
- data/stylesheets/SassyLists/_loop.scss +7 -6
- data/stylesheets/SassyLists/_prepend.scss +7 -7
- data/stylesheets/SassyLists/_purge.scss +9 -9
- data/stylesheets/SassyLists/_random-value.scss +3 -3
- data/stylesheets/SassyLists/_remove-nth.scss +2 -2
- data/stylesheets/SassyLists/_remove.scss +2 -2
- data/stylesheets/SassyLists/_slice.scss +3 -3
- data/stylesheets/SassyLists/_to-string.scss +1 -1
- data/stylesheets/SassyLists/_union.scss +2 -2
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
* `0.4.
|
4
|
-
* `0.4.
|
3
|
+
* `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
|
4
|
+
* `0.4.1`: improving `intersection()` perf
|
5
|
+
* `0.4.0`: adding `intersection()`
|
5
6
|
* `0.3.5`: improving `debug()`, `to-string()` and `chunk()`
|
6
7
|
* `0.3.4`: fixing a minor issue in `insert-nth()`, `replace-nth()` and `prepend()`
|
7
|
-
* `0.3.3`:
|
8
|
-
* `0.3.2`:
|
9
|
-
* `0.3.1`:
|
8
|
+
* `0.3.3`: removing dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
|
9
|
+
* `0.3.2`: removing dependence to `purge()` from `replace()`
|
10
|
+
* `0.3.1`: adding aliases and cleaned `to-string()`
|
10
11
|
* `0.3.0`: adding `contains()`, `flatten()`, `union()`
|
11
12
|
* `0.2.4`: improving `debug()`
|
12
13
|
* `0.2.3`: fixing important issues with comments
|
data/lib/SassyLists.rb
CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('SassyLists', :path => extension_path)
|
|
5
5
|
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
6
6
|
# Date is in the form of YYYY-MM-DD
|
7
7
|
module SassyLists
|
8
|
-
VERSION = "0.4.
|
9
|
-
DATE = "2013-11-
|
8
|
+
VERSION = "0.4.2"
|
9
|
+
DATE = "2013-11-15"
|
10
10
|
end
|
11
11
|
|
12
12
|
module Sass::Script::Functions
|
@@ -13,10 +13,10 @@
|
|
13
13
|
// @return [Boolean]
|
14
14
|
|
15
15
|
@function contain($list, $value) {
|
16
|
-
|
16
|
+
@return not not index($list, $value)
|
17
17
|
}
|
18
18
|
|
19
19
|
// Alias
|
20
20
|
@function include($list, $value) {
|
21
|
-
|
21
|
+
@return contain($list, $value);
|
22
22
|
}
|
@@ -2,6 +2,8 @@
|
|
2
2
|
// -------------------------------------------------------------------------------
|
3
3
|
// @documentation http://sassylists.com/documentation/#first
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
+
// @alias `head()`
|
6
|
+
// -------------------------------------------------------------------------------
|
5
7
|
// @example first(a b c) => a
|
6
8
|
// -------------------------------------------------------------------------------
|
7
9
|
// @param $list [List] : list
|
@@ -9,5 +11,10 @@
|
|
9
11
|
// @return [Literal]
|
10
12
|
|
11
13
|
@function first($list) {
|
12
|
-
|
14
|
+
@return nth($list, 1);
|
15
|
+
}
|
16
|
+
|
17
|
+
// Alias
|
18
|
+
@function head($list) {
|
19
|
+
@return first($list);
|
13
20
|
}
|
@@ -2,10 +2,12 @@
|
|
2
2
|
// -------------------------------------------------------------------------------
|
3
3
|
// @documentation http://sassylists.com/documentation/#insert-nth
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
-
// @example insert-nth(a b c, 2, z) => a
|
5
|
+
// @example insert-nth(a b c, 2, z) => a z d c
|
6
6
|
// @example insert-nth(a b c, 0, z) => error
|
7
7
|
// @example insert-nth(a b c, -1, z) => error
|
8
8
|
// @example insert-nth(a b c, 10, z) => error
|
9
|
+
// @example insert-nth(a b c, 4, z) => a b c d
|
10
|
+
// @example insert-nth(a b c, 5, z) => error
|
9
11
|
// -------------------------------------------------------------------------------
|
10
12
|
// @param $list [List] : list
|
11
13
|
// @param $index [Number] : index to add
|
@@ -31,8 +33,7 @@
|
|
31
33
|
}
|
32
34
|
|
33
35
|
@else if $index > length($list) {
|
34
|
-
@
|
35
|
-
@return $result;
|
36
|
+
@return append($list, $value);
|
36
37
|
}
|
37
38
|
|
38
39
|
@else {
|
@@ -15,10 +15,11 @@
|
|
15
15
|
// @return [Boolean]
|
16
16
|
|
17
17
|
@function is-symmetrical($list) {
|
18
|
-
|
18
|
+
$reverse: reverse($list);
|
19
|
+
@return $reverse == reverse($reverse);
|
19
20
|
}
|
20
21
|
|
21
22
|
// Alias
|
22
23
|
@function is-mirror($list) {
|
23
|
-
|
24
|
+
@return is-symmetrical($list);
|
24
25
|
}
|
@@ -11,12 +11,13 @@
|
|
11
11
|
// @return [Number] | null
|
12
12
|
|
13
13
|
@function last-index($list, $value) {
|
14
|
-
|
15
|
-
@for $i from length($list) * -1 through -1 {
|
16
|
-
@if nth($list, abs($i)) == $value {
|
17
|
-
@return abs($i);
|
18
|
-
}
|
19
|
-
}
|
20
14
|
|
21
|
-
|
15
|
+
@for $i from length($list) * -1 through -1 {
|
16
|
+
$i: abs($i);
|
17
|
+
@if nth($list, $i) == $value {
|
18
|
+
@return $i;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
@return null;
|
22
23
|
}
|
@@ -2,6 +2,8 @@
|
|
2
2
|
// -------------------------------------------------------------------------------
|
3
3
|
// @documentation http://sassylists.com/documentation/#last
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
+
// @alias `tail()`
|
6
|
+
// -------------------------------------------------------------------------------
|
5
7
|
// @example last(a b c) => c
|
6
8
|
// -------------------------------------------------------------------------------
|
7
9
|
// @param $list [List] : list
|
@@ -9,5 +11,10 @@
|
|
9
11
|
// @return [Literal]
|
10
12
|
|
11
13
|
@function last($list) {
|
12
|
-
|
14
|
+
@return nth($list, length($list));
|
15
|
+
}
|
16
|
+
|
17
|
+
// Alias
|
18
|
+
@function tail($list) {
|
19
|
+
@return last($list);
|
13
20
|
}
|
@@ -14,16 +14,17 @@
|
|
14
14
|
// @return [List]
|
15
15
|
|
16
16
|
@function loop($list, $value: 1) {
|
17
|
-
|
17
|
+
$result: ();
|
18
|
+
$length: length($list);
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
@for $i from 0 to $length {
|
21
|
+
$result: append($result, nth($list, ($i - $value) % $length + 1));
|
22
|
+
}
|
22
23
|
|
23
|
-
|
24
|
+
@return $result;
|
24
25
|
}
|
25
26
|
|
26
27
|
// Alias
|
27
28
|
@function shift-indexes($list, $value: 1) {
|
28
|
-
|
29
|
+
@return loop($list, $value);
|
29
30
|
}
|
@@ -11,11 +11,11 @@
|
|
11
11
|
// @return [List]
|
12
12
|
|
13
13
|
@function prepend($list, $value) {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
@if $value != null and $value != "" {
|
15
|
+
@return join($value, $list);
|
16
|
+
}
|
17
|
+
|
18
|
+
@else {
|
19
|
+
@return $list;
|
20
|
+
}
|
21
21
|
}
|
@@ -13,22 +13,22 @@
|
|
13
13
|
// @return [List]
|
14
14
|
|
15
15
|
@function purge($list) {
|
16
|
-
|
16
|
+
$result: ();
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@each $item in $list {
|
19
|
+
@if $item and $item != "" {
|
20
|
+
$result: append($result, $item);
|
21
|
+
}
|
22
|
+
}
|
23
23
|
|
24
|
-
|
24
|
+
@return $result;
|
25
25
|
}
|
26
26
|
|
27
27
|
// Aliases
|
28
28
|
@function compact($list) {
|
29
|
-
|
29
|
+
@return purge($list);
|
30
30
|
}
|
31
31
|
|
32
32
|
@function clean($list) {
|
33
|
-
|
33
|
+
@return purge($list);
|
34
34
|
}
|
@@ -14,14 +14,14 @@
|
|
14
14
|
// @return [Literal]
|
15
15
|
|
16
16
|
@function random-value($list) {
|
17
|
-
|
17
|
+
@return nth($list, random(length($list)) + 1);
|
18
18
|
}
|
19
19
|
|
20
20
|
// Aliases
|
21
21
|
@function roll($list) {
|
22
|
-
|
22
|
+
@return random-value($list);
|
23
23
|
}
|
24
24
|
|
25
25
|
@function luck($list) {
|
26
|
-
|
26
|
+
@return random-value($list);
|
27
27
|
}
|
@@ -22,10 +22,10 @@
|
|
22
22
|
// @return [List] | false
|
23
23
|
|
24
24
|
@function remove-nth($list, $index) {
|
25
|
-
|
25
|
+
@return replace-nth($list, $index, "");
|
26
26
|
}
|
27
27
|
|
28
28
|
// Alias
|
29
29
|
@function without-nth($list, $index) {
|
30
|
-
|
30
|
+
@return remove-nth($list, $index);
|
31
31
|
}
|
@@ -18,10 +18,10 @@
|
|
18
18
|
// @return [List]
|
19
19
|
|
20
20
|
@function remove($list, $value, $recursive: false) {
|
21
|
-
|
21
|
+
@return replace($list, $value, null, $recursive);
|
22
22
|
}
|
23
23
|
|
24
24
|
// Alias
|
25
25
|
@function without($list, $value, $recursive: false) {
|
26
|
-
|
26
|
+
@return remove($list, $value, $recursive);
|
27
27
|
}
|
@@ -23,12 +23,12 @@
|
|
23
23
|
|
24
24
|
@function slice($list, $start: 1, $end: length($list)) {
|
25
25
|
$result: false;
|
26
|
-
|
26
|
+
|
27
27
|
@if type-of($start) != number or type-of($end) != number {
|
28
28
|
@warn "List indexes #{$start} and #{$end} must be numbers for `slice`.";
|
29
29
|
@return $result;
|
30
30
|
}
|
31
|
-
|
31
|
+
|
32
32
|
@else if $start > $end {
|
33
33
|
@warn "Start index is #{$start} but has to be lesser than or equals to the end index (#{$end}) for `slice`.";
|
34
34
|
@return $result;
|
@@ -43,7 +43,7 @@
|
|
43
43
|
@warn "Start index is #{$start} but list is only #{length($list)} items long for `slice`.";
|
44
44
|
@return $result;
|
45
45
|
}
|
46
|
-
|
46
|
+
|
47
47
|
@else if $end > length($list) {
|
48
48
|
@warn "End index is #{$end} but list is only #{length($list)} items long for `slice`.";
|
49
49
|
@return $result;
|
@@ -14,10 +14,10 @@
|
|
14
14
|
// @return [List]
|
15
15
|
|
16
16
|
@function union($lists...) {
|
17
|
-
|
17
|
+
@return remove-duplicates(flatten($lists));
|
18
18
|
}
|
19
19
|
|
20
20
|
// Alias
|
21
21
|
@function merge($lists...) {
|
22
|
-
|
22
|
+
@return union($lists...);
|
23
23
|
}
|
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.
|
4
|
+
version: 0.4.2
|
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: 2013-11-
|
12
|
+
date: 2013-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|