SassyLists 0.4.2 → 0.4.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.4.3`: improving `insert-nth()`, `prepend()`, `replace-nth()` and `replace()` to prevevent from adding empty lists
3
4
  * `0.4.2`: improving `insert-nth()` and cleaning some indentation issues
4
5
  * `0.4.1`: improving `intersection()` perf
5
6
  * `0.4.0`: adding `intersection()`
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.2"
9
- DATE = "2013-11-15"
8
+ VERSION = "0.4.3"
9
+ DATE = "2013-11-17"
10
10
  end
11
11
 
12
12
  module Sass::Script::Functions
@@ -24,8 +24,7 @@
24
24
  }
25
25
 
26
26
  @else {
27
- $count: nth($counts, $index) + 1;
28
- $counts: replace-nth($counts, $index, $count);
27
+ $counts: replace-nth($counts, $index, nth($counts, $index) + 1);
29
28
  }
30
29
  }
31
30
 
@@ -5,9 +5,7 @@
5
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
- // @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
8
+ // @example insert-nth(a b c, 10, z) => a b c z
11
9
  // -------------------------------------------------------------------------------
12
10
  // @param $list [List] : list
13
11
  // @param $index [Number] : index to add
@@ -41,7 +39,7 @@
41
39
 
42
40
  @for $i from 1 through length($list) {
43
41
  @if $i == $index {
44
- @if $value != null and $value != "" {
42
+ @if $value and $value != "" and $value != () {
45
43
  $result: append($result, $value);
46
44
  }
47
45
  }
@@ -11,7 +11,7 @@
11
11
  // @return [List]
12
12
 
13
13
  @function prepend($list, $value) {
14
- @if $value != null and $value != "" {
14
+ @if $value and $value != "" and $value != () {
15
15
  @return join($value, $list);
16
16
  }
17
17
 
@@ -16,7 +16,7 @@
16
16
  $result: ();
17
17
 
18
18
  @each $item in $list {
19
- @if $item and $item != "" {
19
+ @if $item and $item != "" and $value != () {
20
20
  $result: append($result, $item);
21
21
  }
22
22
  }
@@ -41,7 +41,7 @@
41
41
  $index: if($index < 0, length($list) + $index + 1, $index);
42
42
 
43
43
  @for $i from 1 through length($list) {
44
- @if $value != null and $value != "" {
44
+ @if $value and $value != "" and $value != () {
45
45
  $result: append($result, if($i == $index, $value, nth($list, $i)));
46
46
  }
47
47
  }
@@ -8,24 +8,24 @@
8
8
  // @example replace( (a, b, c a), a, z, true ) => z, b, c z
9
9
  // -------------------------------------------------------------------------------
10
10
  // @param $list [List] : list
11
- // @param $old-value [Literal] : value to replace
12
- // @param $new-value [Literal] : new value for $old-value
11
+ // @param $old [Literal] : value to replace
12
+ // @param $value [Literal] : new value for $old-value
13
13
  // @param $recursive [Boolean] : enable / disable recursivity
14
14
  // -------------------------------------------------------------------------------
15
15
  // @return [List]
16
16
 
17
- @function replace($list, $old-value, $new-value, $recursive: false) {
17
+ @function replace($list, $old, $value, $recursive: false) {
18
18
  $result: ();
19
19
 
20
20
  @each $item in $list {
21
- @if $item == $old-value {
22
- @if $new-value != '' and $new-value != null {
23
- $result: append($result, $new-value);
21
+ @if $item == $old {
22
+ @if $value and $value != '' and $value != () {
23
+ $result: append($result, $value);
24
24
  }
25
25
  }
26
26
 
27
27
  @else if length($item) > 1 and $recursive {
28
- $result: append($result, replace($item, $old-value, $new-value, $recursive));
28
+ $result: append($result, replace($item, $old, $value, $recursive));
29
29
  }
30
30
 
31
31
  @else {
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.2
4
+ version: 0.4.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-15 00:00:00.000000000 Z
12
+ date: 2013-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass