SassyLists 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Changelog
2
2
 
3
+ * `0.3.3`: removed dependence to `purge()` from all functions; fixed an issue with `sort()`; fixed an issue with error messages
3
4
  * `0.3.2`: removed dependence to `purge()` from `replace()`
4
5
  * `0.3.1`: added aliases and cleaned `to-string()`
5
6
  * `0.3.0`: adding `contains()`, `flatten()`, `union()`
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.3.2"
9
- DATE = "2013-11-05"
8
+ VERSION = "0.3.3"
9
+ DATE = "2013-11-06"
10
10
  end
11
11
 
12
12
  module Sass::Script::Functions
@@ -23,17 +23,17 @@
23
23
  $result: false;
24
24
 
25
25
  @if type-of($index) != number {
26
- @warn "List index #{quote($index)} is not a number for `insert-nth`.";
26
+ @warn "List index #{$index} is not a number for `insert-nth`.";
27
27
  @return $result;
28
28
  }
29
29
 
30
30
  @else if $index < 1 {
31
- @warn "List index #{quote($index)} must be a non-zero integer for `insert-nth`";
31
+ @warn "List index #{$index} must be a non-zero integer for `insert-nth`";
32
32
  @return $result;
33
33
  }
34
34
 
35
35
  @else if $index > length($list) {
36
- @warn "List index is #{quote($index)} but list is only #{length($list)} items long for `insert-nth'.";
36
+ @warn "List index is #{$index} but list is only #{length($list)} items long for `insert-nth'.";
37
37
  @return $result;
38
38
  }
39
39
 
@@ -42,7 +42,9 @@
42
42
 
43
43
  @for $i from 1 through length($list) {
44
44
  @if $i == $index {
45
- $result: append($result, $value);
45
+ @if $value != null and $value != "" {
46
+ $result: append($result, $value);
47
+ }
46
48
  }
47
49
 
48
50
  $result: append($result, nth($list, $i));
@@ -13,5 +13,11 @@
13
13
  // @return [List]
14
14
 
15
15
  @function prepend($list, $value) {
16
- @return purge(join($value, $list));
16
+ @if $value != null and $value != "" {
17
+ @return purge(join($value, $list));
18
+ }
19
+
20
+ @else {
21
+ @return $list;
22
+ }
17
23
  }
@@ -24,7 +24,7 @@
24
24
  $result: false;
25
25
 
26
26
  @if type-of($index) != number {
27
- @warn "List index #{quote($index)} is not a number for `replace-nth`/`remove-nth`.";
27
+ @warn "List index #{$index} is not a number for `replace-nth`/`remove-nth`.";
28
28
  @return $result;
29
29
  }
30
30
 
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  @else if abs($index) > length($list) {
37
- @warn "List index is #{quote($index)} but list is only #{length($list)} item long for `replace-nth`/`remove-nth`.";
37
+ @warn "List index is #{$index} but list is only #{length($list)} item long for `replace-nth`/`remove-nth`.";
38
38
  @return $result;
39
39
  }
40
40
 
@@ -43,7 +43,9 @@
43
43
  $index: if($index < 0, length($list) + $index + 1, $index);
44
44
 
45
45
  @for $i from 1 through length($list) {
46
- $result: append($result, if($i == $index, $value, nth($list, $i)));
46
+ @if $value != null and $value != "" {
47
+ $result: append($result, if($i == $index, $value, nth($list, $i)));
48
+ }
47
49
  }
48
50
  }
49
51
 
@@ -25,12 +25,12 @@
25
25
  $result: false;
26
26
 
27
27
  @if type-of($start) != number or type-of($end) != number {
28
- @warn "List indexes #{quote($start)} and #{quote($end)} must be numbers for `slice`.";
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
- @warn "Start index is #{quote($start)} but has to be lesser than or equals to the end index (#{quote($end)}) for `slice`.";
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;
35
35
  }
36
36
 
@@ -40,12 +40,12 @@
40
40
  }
41
41
 
42
42
  @else if $start > length($list) {
43
- @warn "Start index is #{quote($start)} but list is only #{length($list)} items long for `slice`.";
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
- @warn "End index is #{quote($end)} but list is only #{length($list)} items long for `slice`.";
48
+ @warn "End index is #{$end} but list is only #{length($list)} items long for `slice`.";
49
49
  @return $result;
50
50
  }
51
51
 
@@ -16,7 +16,7 @@
16
16
  // -------------------------------------------------------------------------------
17
17
  // @return [List]
18
18
 
19
- @function sort($list, $force: false) {
19
+ @function sort($list) {
20
20
  $result : nth($list, 1);
21
21
 
22
22
  @if length($list) > 1 {
@@ -26,7 +26,7 @@
26
26
 
27
27
  @if type-of($item) == number {
28
28
 
29
- @if unitless($item) and $force {
29
+ @if unitless($item) {
30
30
 
31
31
  @if $item > last($result) {
32
32
  $result: append($result, $item);
@@ -64,6 +64,6 @@
64
64
  }
65
65
 
66
66
  // Alias
67
- @function order($list, $force: false) {
68
- @return sort($list, $force);
67
+ @function order($list) {
68
+ @return sort($list);
69
69
  }
@@ -18,7 +18,7 @@
18
18
  @each $item in $list {
19
19
  @if type-of($item) == number {
20
20
 
21
- @if $force and unit($item) {
21
+ @if $force and not unitless($item) {
22
22
  $item: $item / ($item * 0 + 1);
23
23
  }
24
24
 
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.3.2
4
+ version: 0.3.3
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-05 00:00:00.000000000 Z
12
+ date: 2013-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass