SassyStrings 1.0.1 → 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 +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +5 -0
- data/lib/SassyStrings.rb +2 -2
- data/stylesheets/_SassyStrings.scss +2 -20
- data/stylesheets/private/_all.scss +24 -0
- data/stylesheets/private/_char-at.scss +16 -0
- data/stylesheets/private/_levenshtein.scss +105 -0
- data/stylesheets/private/_str-count.scss +27 -0
- data/stylesheets/private/_str-ends-with.scss +16 -0
- data/stylesheets/private/_str-explode.scss +41 -0
- data/stylesheets/private/_str-implode.scss +21 -0
- data/stylesheets/private/_str-last-index.scss +27 -0
- data/stylesheets/private/_str-lcfirst.scss +15 -0
- data/stylesheets/private/_str-pad.scss +36 -0
- data/stylesheets/private/_str-printf.scss +29 -0
- data/stylesheets/private/_str-repeat.scss +22 -0
- data/stylesheets/private/_str-replace.scss +33 -0
- data/stylesheets/private/_str-reverse.scss +21 -0
- data/stylesheets/private/_str-rot.scss +39 -0
- data/stylesheets/private/_str-shuffle.scss +36 -0
- data/stylesheets/private/_str-starts-with.scss +16 -0
- data/stylesheets/private/_str-trim.scss +31 -0
- data/stylesheets/private/_str-ucfirst.scss +15 -0
- data/stylesheets/{functions → private}/_str-word-count.scss +5 -6
- data/stylesheets/private/_stringify.scss +26 -0
- data/stylesheets/public/_all.scss +23 -0
- data/stylesheets/public/_char-at.scss +31 -0
- data/stylesheets/public/_levenshtein.scss +26 -0
- data/stylesheets/public/_str-count.scss +26 -0
- data/stylesheets/public/_str-ends-with.scss +26 -0
- data/stylesheets/public/_str-explode.scss +26 -0
- data/stylesheets/public/_str-implode.scss +19 -0
- data/stylesheets/{functions → public}/_str-last-index.scss +5 -12
- data/stylesheets/public/_str-lcfirst.scss +20 -0
- data/stylesheets/public/_str-pad.scss +33 -0
- data/stylesheets/public/_str-printf.scss +21 -0
- data/stylesheets/public/_str-repeat.scss +26 -0
- data/stylesheets/public/_str-replace.scss +39 -0
- data/stylesheets/public/_str-reverse.scss +20 -0
- data/stylesheets/public/_str-rot.scss +26 -0
- data/stylesheets/public/_str-shuffle.scss +18 -0
- data/stylesheets/public/_str-starts-with.scss +26 -0
- data/stylesheets/public/_str-trim.scss +20 -0
- data/stylesheets/{functions → public}/_str-ucfirst.scss +6 -2
- data/stylesheets/public/_str-word-count.scss +20 -0
- data/stylesheets/public/_stringify.scss +15 -0
- metadata +44 -22
- data/stylesheets/functions/_char-at.scss +0 -25
- data/stylesheets/functions/_levenshtein.scss +0 -99
- data/stylesheets/functions/_str-count.scss +0 -31
- data/stylesheets/functions/_str-ends-with.scss +0 -20
- data/stylesheets/functions/_str-explode.scss +0 -45
- data/stylesheets/functions/_str-implode.scss +0 -15
- data/stylesheets/functions/_str-lcfirst.scss +0 -14
- data/stylesheets/functions/_str-pad.scss +0 -45
- data/stylesheets/functions/_str-printf.scss +0 -28
- data/stylesheets/functions/_str-repeat.scss +0 -26
- data/stylesheets/functions/_str-replace.scss +0 -47
- data/stylesheets/functions/_str-reverse.scss +0 -20
- data/stylesheets/functions/_str-rot.scss +0 -43
- data/stylesheets/functions/_str-shuffle.scss +0 -26
- data/stylesheets/functions/_str-starts-with.scss +0 -20
- data/stylesheets/functions/_str-trim.scss +0 -30
- data/stylesheets/functions/_stringify.scss +0 -21
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Shuffle characters from $string
|
|
2
|
-
// ----------------------------------------------------------------------------------------------------
|
|
3
|
-
// @param [string] $string: string
|
|
4
|
-
// ----------------------------------------------------------------------------------------------------
|
|
5
|
-
// @return [string]
|
|
6
|
-
|
|
7
|
-
@function str-shuffle($string) {
|
|
8
|
-
@return str-implode(_shuffle(str-explode($string)));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Shuffle a list
|
|
12
|
-
// ----------------------------------------------------------------------------------------------------
|
|
13
|
-
// @param [list] $list: shuffle a list
|
|
14
|
-
// ----------------------------------------------------------------------------------------------------
|
|
15
|
-
// @return [list]
|
|
16
|
-
|
|
17
|
-
@function _shuffle($list) {
|
|
18
|
-
@for $i from -1 * length($list) through -1 {
|
|
19
|
-
$i: abs($i);
|
|
20
|
-
$j: random(length($list) - 1) + 1;
|
|
21
|
-
$tmp: nth($list, $i);
|
|
22
|
-
$list: set-nth($list, $i, nth($list, $j));
|
|
23
|
-
$list: set-nth($list, $j, $tmp);
|
|
24
|
-
}
|
|
25
|
-
@return $list;
|
|
26
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Check whether $string stars with $needle
|
|
2
|
-
// ----------------------------------------------------------------------------------------------------
|
|
3
|
-
// @param [string] $string: string
|
|
4
|
-
// @param [string] $needle: substring to check
|
|
5
|
-
// ----------------------------------------------------------------------------------------------------
|
|
6
|
-
// @return [bool] | false
|
|
7
|
-
|
|
8
|
-
@function str-starts-with($string, $needle) {
|
|
9
|
-
@if type-of($string) != "string" {
|
|
10
|
-
@warn "`str-starts-with` function expecting a string for $string; #{type-of($string)} given.";
|
|
11
|
-
@return false;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@if type-of($needle) != "string" {
|
|
15
|
-
@warn "`str-starts-with` function expecting a string for $needle; #{type-of($needle)} given.";
|
|
16
|
-
@return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@return str-slice($string, 1, str-length($needle)) == $needle;
|
|
20
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Remove all trailing and leading whitespaces from $string
|
|
2
|
-
// ----------------------------------------------------------------------------------------------------
|
|
3
|
-
// @param [string] $string: string
|
|
4
|
-
// ----------------------------------------------------------------------------------------------------
|
|
5
|
-
// @return [string] | false
|
|
6
|
-
|
|
7
|
-
@function str-trim($string) {
|
|
8
|
-
@if type-of($string) != "string" {
|
|
9
|
-
@warn "`str-trim` function expecting a string for $string; #{type-of($string)} given.";
|
|
10
|
-
@return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
$start: 1;
|
|
14
|
-
$end: str-length($string);
|
|
15
|
-
|
|
16
|
-
@for $i from 1 through str-length($string) {
|
|
17
|
-
$first: str-slice($string, $i, $i);
|
|
18
|
-
$last: str-slice($string, -$i, -$i);
|
|
19
|
-
|
|
20
|
-
@if $first == " " and $i + 1 == $start + 1 {
|
|
21
|
-
$start: $i + 1;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@if $last == " " and str-length($string) - $i == $end - 1 {
|
|
25
|
-
$end: str-length($string) - $i;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@return str-slice($string, $start, $end);
|
|
30
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Cast anything to string
|
|
2
|
-
// ----------------------------------------------------------------------------------------------------
|
|
3
|
-
// @param [literal] $literal: literal to cast to string
|
|
4
|
-
// ----------------------------------------------------------------------------------------------------
|
|
5
|
-
// @return [string]
|
|
6
|
-
|
|
7
|
-
@function stringify($literal) {
|
|
8
|
-
$result: "";
|
|
9
|
-
|
|
10
|
-
@if length($literal) == 1 {
|
|
11
|
-
$result: $literal + unquote("");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@else {
|
|
15
|
-
@each $item in $literal {
|
|
16
|
-
$result: $result + stringify($item);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@return quote($result);
|
|
21
|
-
}
|