Travis build: 209

This commit is contained in:
Travis CI
2017-12-23 19:13:32 +00:00
parent bb2e544011
commit f59259db0d
3 changed files with 69 additions and 0 deletions

View File

@ -167,6 +167,10 @@
* [`UUIDGenerator`](#uuidgenerator) * [`UUIDGenerator`](#uuidgenerator)
* [`validateNumber`](#validatenumber) * [`validateNumber`](#validatenumber)
### _Uncategorized_
* [`repeatString`](#repeatstring)
* [`toKebabCase`](#tokebabcase)
## Adapter ## Adapter
### call ### call
@ -2289,6 +2293,42 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) ==
// validateNumber('10') -> true // validateNumber('10') -> true
``` ```
[⬆ back to top](#table-of-contents)
## _Uncategorized_
### repeatString
Repeats a string n times using `String.repeat()`
If no string is provided the default is `""` and the default number of times is 2.
```js
const repeatString = (str="",num=2) => {
return num >= 0 ? str.repeat(num) : str;
}
// repeatString("abc",3) -> 'abcabcabc'
// repeatString("abc") -> 'abcabc'
```
[⬆ back to top](#table-of-contents)
### toKebabCase
Converts a string to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
Use `replace()` to add spaces before capital letters, convert `toLowerCase()`, then `replace()` underscores and spaces with hyphens.
Also check if a string starts with a hyphen and remove it if yes.
```js
const toKebabCase = str => {
str = str.replace(/([A-Z])/g," $1").toLowerCase().replace(/_/g,' ').replace(/-/g,' ').replace(/\s\s+/g, ' ').replace(/\s/g,'-');
return str.startsWith('-') ? str.slice(1,str.length) : str;
}
// toKebabCase("camelCase") -> 'camel-case'
// toKebabCase("some text") -> 'some-text'
// toKebabCase("some-mixed_string With spaces_underscores-and-hyphens") -> 'some-mixed-string-with-spaces-underscores-and-hyphens'
// toKebabCase("AllThe-small Things") -> "all-the-small-things"
```
[⬆ back to top](#table-of-contents) [⬆ back to top](#table-of-contents)
## Credits ## Credits

View File

@ -206,6 +206,10 @@
<a class="sublink-1" href="#uuidgenerator">UUIDGenerator</a> <a class="sublink-1" href="#uuidgenerator">UUIDGenerator</a>
<a class="sublink-1" href="#validatenumber">validateNumber</a> <a class="sublink-1" href="#validatenumber">validateNumber</a>
<h3>Uncategorized
</h3><a class="sublink-1" href="#repeatstring">repeatString</a>
<a class="sublink-1" href="#tokebabcase">toKebabCase</a>
</nav><main class="col-sm-12 col-md-8 col-lg-9" style="height:100%;overflow-y:auto;background:#eceef2;padding:0"><a id="top">&nbsp;</a><h2 style="text-align:center">Adapter</h2> </nav><main class="col-sm-12 col-md-8 col-lg-9" style="height:100%;overflow-y:auto;background:#eceef2;padding:0"><a id="top">&nbsp;</a><h2 style="text-align:center">Adapter</h2>
<div class="card fluid"><div class="section double-padded"><h3 id="call">call</h3></div><div class="section double-padded"> <div class="card fluid"><div class="section double-padded"><h3 id="call">call</h3></div><div class="section double-padded">
<p>Given a key and a set of arguments, call them when given a context. Primarily useful in composition.</p> <p>Given a key and a set of arguments, call them when given a context. Primarily useful in composition.</p>
@ -1403,6 +1407,29 @@ Use <code>Number()</code> to check if the coercion holds.</p>
<pre><code class="language-js">const validateNumber = n =&gt; !isNaN(parseFloat(n)) &amp;&amp; isFinite(n) &amp;&amp; Number(n) == n; <pre><code class="language-js">const validateNumber = n =&gt; !isNaN(parseFloat(n)) &amp;&amp; isFinite(n) &amp;&amp; Number(n) == n;
// validateNumber('10') -&gt; true // validateNumber('10') -&gt; true
</code></pre> </code></pre>
</div></div><br/><h2 style="text-align:center">Uncategorized</h2>
<div class="card fluid"><div class="section double-padded"><h3 id="repeatstring">repeatString</h3></div><div class="section double-padded">
<p>Repeats a string n times using <code>String.repeat()</code></p>
<p>If no string is provided the default is <code>&quot;&quot;</code> and the default number of times is 2.</p>
<pre><code class="language-js">const repeatString = (str=&quot;&quot;,num=2) =&gt; {
return num &gt;= 0 ? str.repeat(num) : str;
}
// repeatString(&quot;abc&quot;,3) -&gt; 'abcabcabc'
// repeatString(&quot;abc&quot;) -&gt; 'abcabc'
</code></pre>
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="tokebabcase">toKebabCase</h3></div><div class="section double-padded">
<p>Converts a string to <a href="https://en.wikipedia.org/wiki/Letter_case#Special_case_styles">kebab case</a>.
Use <code>replace()</code> to add spaces before capital letters, convert <code>toLowerCase()</code>, then <code>replace()</code> underscores and spaces with hyphens.
Also check if a string starts with a hyphen and remove it if yes.</p>
<pre><code class="language-js">const toKebabCase = str =&gt; {
str = str.replace(/([A-Z])/g,&quot; $1&quot;).toLowerCase().replace(/_/g,' ').replace(/-/g,' ').replace(/\s\s+/g, ' ').replace(/\s/g,'-');
return str.startsWith('-') ? str.slice(1,str.length) : str;
}
// toKebabCase(&quot;camelCase&quot;) -&gt; 'camel-case'
// toKebabCase(&quot;some text&quot;) -&gt; 'some-text'
// toKebabCase(&quot;some-mixed_string With spaces_underscores-and-hyphens&quot;) -&gt; 'some-mixed-string-with-spaces-underscores-and-hyphens'
// toKebabCase(&quot;AllThe-small Things&quot;) -&gt; &quot;all-the-small-things&quot;
</code></pre>
</div></div><br/> </div></div><br/>
<footer> <footer>
<p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br/>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br/>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br/>Built with the <a href="https://minicss.org">mini.css framework</a>.</p> <p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br/>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br/>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br/>Built with the <a href="https://minicss.org">mini.css framework</a>.</p>

View File

@ -97,6 +97,7 @@ randomNumberInRange:math
readFileLines:node readFileLines:node
redirect:browser redirect:browser
remove:array remove:array
repeatString:uncategorized
reverseString:string reverseString:string
RGBToHex:utility RGBToHex:utility
round:math round:math
@ -120,6 +121,7 @@ timeTaken:utility
toCamelCase:string toCamelCase:string
toDecimalMark:utility toDecimalMark:utility
toEnglishDate:date toEnglishDate:date
toKebabCase:uncategorized
toOrdinalSuffix:utility toOrdinalSuffix:utility
truncateString:string truncateString:string
truthCheckCollection:object truthCheckCollection:object