SassyStrings 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/README.md +5 -1
- data/lib/SassyStrings.rb +2 -2
- data/stylesheets/_SassyStrings.scss +3 -0
- data/stylesheets/functions/_str-last-index.scss +8 -5
- data/stylesheets/functions/_str-ucfirst.scss +7 -5
- data/stylesheets/functions/_str-word-count.scss +25 -19
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3899887f5222edd4ba1eecc70d5f9050abce8de9
|
4
|
+
data.tar.gz: e02a8b4448c9c00d2272a1b1a1d399d9bf4e1f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be9b497e564554997e0d12d51bc54b6bc36610bdaf2cebc1a151d0563dcfc643a572b15483bafc10c2000f6324572f09c691fa6a5ea805de1c58f4c3bcf81992
|
7
|
+
data.tar.gz: a92dba77ae9cedacc0234a429723f8ac819c1f225d76666196fa73e008c140f306bb844bc651ed389e6ed6af6fe0c87a42030cc92d2a4d4c53f7511c410d897d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Here is a [Compass Extension](http://compass-style.org/) providing you all funct
|
|
7
7
|
* `char-at($string, $index)`: returns the character from `$string` at index `$index`
|
8
8
|
* `levenshtein($a, $b)`: returns the Levenshtein distance betwee `$a` and `$b`
|
9
9
|
* `str-count($string, $needle)`: counts number of occurrences of `$needle` in `$string`
|
10
|
-
* `str-ends-
|
10
|
+
* `str-ends-with($string, $needle)`: returns wether `$string` ends with `$needle`
|
11
11
|
* `str-explode($string, $separator)`: explodes `$string` on `$separator` occurrences
|
12
12
|
* `str-implode($list)`: implodes `$list` into a string
|
13
13
|
* `str-last-index($string, $needle)`: returns last index of `$needle` in `$string`
|
@@ -43,3 +43,7 @@ If you feel like an explorer, you can have a look at the code [here](https://git
|
|
43
43
|
* Compass ~> 1.0
|
44
44
|
|
45
45
|
Some functions depend on other functions. If you include functions individually, make sure to check for these dependencies in their respective docs.
|
46
|
+
|
47
|
+
## Credits
|
48
|
+
|
49
|
+
Huge thanks to [Marc Mintel](http://twitter.com/marcmintel) for his help.
|
data/lib/SassyStrings.rb
CHANGED
@@ -4,8 +4,8 @@ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
|
4
4
|
Compass::Frameworks.register("SassyStrings", :path => "#{File.dirname(__FILE__)}/..")
|
5
5
|
|
6
6
|
module SassyStrings
|
7
|
-
VERSION = "1.0.
|
8
|
-
DATE = "2014-
|
7
|
+
VERSION = "1.0.1"
|
8
|
+
DATE = "2014-02-16"
|
9
9
|
end
|
10
10
|
|
11
11
|
# Sassy String Functions
|
@@ -10,10 +10,13 @@
|
|
10
10
|
@import "functions/str-ends-with";
|
11
11
|
@import "functions/str-explode";
|
12
12
|
@import "functions/str-implode";
|
13
|
+
@import "functions/str-last-index";
|
13
14
|
@import "functions/str-lcfirst";
|
14
15
|
@import "functions/str-pad";
|
16
|
+
@import "functions/str-printf";
|
15
17
|
@import "functions/str-repeat";
|
16
18
|
@import "functions/str-replace";
|
19
|
+
@import "functions/str-reverse";
|
17
20
|
@import "functions/str-rot";
|
18
21
|
@import "functions/str-shuffle";
|
19
22
|
@import "functions/str-starts-with";
|
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
/*
|
2
|
+
* Return last index of $needle in $string
|
3
|
+
* ---
|
4
|
+
* @param {string} $string - string to search in
|
5
|
+
* @param {string} $needle - substring to search for
|
6
|
+
* ---
|
7
|
+
* @return {number | null | false}
|
8
|
+
*/
|
6
9
|
|
7
10
|
@function str-last-index($string, $needle) {
|
8
11
|
@if type-of($string) != "string" {
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
/*
|
2
|
+
* Capitalize first letter from $string
|
3
|
+
* ---
|
4
|
+
* @param {string} $string - string for capitalization
|
5
|
+
* ---
|
6
|
+
* @return {string | false}
|
7
|
+
*/
|
6
8
|
|
7
9
|
@function str-ucfirst($string) {
|
8
10
|
@if type-of($string) != "string" {
|
@@ -1,26 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
/*
|
2
|
+
* Count number of words in $string
|
3
|
+
* ---
|
4
|
+
* @param {string} $string - string to check
|
5
|
+
* ---
|
6
|
+
* @return {string|false}
|
7
|
+
*/
|
6
8
|
|
7
9
|
@function str-word-count($string) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
@if type-of($string) != "string" {
|
11
|
+
@warn "`str-word-count` function expecting a string for $string; #{type-of($string)} given.";
|
12
|
+
@return false;
|
13
|
+
}
|
14
|
+
|
15
|
+
@if $string == '' {
|
16
|
+
@return 0;
|
17
|
+
}
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
$string: str-trim($string);
|
20
|
+
$words: ();
|
21
|
+
$i: str-length($string);
|
16
22
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
@while $i > 0 {
|
24
|
+
@if str-slice($string, $i, $i) == " " {
|
25
|
+
$words: append($words, str-slice($string, $i + 1));
|
26
|
+
$string: str-slice($string, 1, $i - 1);
|
27
|
+
}
|
28
|
+
$i: $i - 1;
|
21
29
|
}
|
22
|
-
$i: $i - 1;
|
23
|
-
}
|
24
30
|
|
25
|
-
|
31
|
+
@return length(append($words, $string));
|
26
32
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SassyStrings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hugo Giraudel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '1.2'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project: SassyStrings
|
91
|
-
rubygems_version: 2.0.
|
91
|
+
rubygems_version: 2.0.14
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Advanced String handling for Sass
|