Travis build: 2133

This commit is contained in:
30secondsofcode
2018-06-07 19:21:52 +00:00
parent b0f5aa57a1
commit 1f809afa27
14 changed files with 15 additions and 13 deletions

View File

@ -255,4 +255,4 @@
</pre><button class="primary clipboard-copy">&#128203;&nbsp;Copy to clipboard</button></div></div><div class="card fluid"><h3 id="words" class="section double-padded">words</h3><div class="section double-padded"><p>Converts a given string into an array of words.</p><p>Use <code>String.split()</code> with a supplied pattern (defaults to non-alpha as a regexp) to convert to an array of strings. Use <code>Array.filter()</code> to remove any empty strings. Omit the second argument to use the default regexp.</p><pre class="language-js"><span class="token keyword">const</span> words <span class="token operator">=</span> <span class="token punctuation">(</span>str<span class="token punctuation">,</span> pattern <span class="token operator">=</span> <span class="token regex">/[^a-zA-Z-]+/</span><span class="token punctuation">)</span> <span class="token operator">=></span> str<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span>pattern<span class="token punctuation">).</span><span class="token function">filter</span><span class="token punctuation">(</span>Boolean<span class="token punctuation">);</span>
</pre><label class="collapse">Show examples</label><pre class="language-js"><span class="token function">words</span><span class="token punctuation">(</span><span class="token string">'I love javaScript!!'</span><span class="token punctuation">);</span> <span class="token comment">// ["I", "love", "javaScript"]</span>
<span class="token function">words</span><span class="token punctuation">(</span><span class="token string">'python, javaScript &amp; coffee'</span><span class="token punctuation">);</span> <span class="token comment">// ["python", "javaScript", "coffee"]</span>
</pre><button class="primary clipboard-copy">&#128203;&nbsp;Copy to clipboard</button></div></div><button class="scroll-to-top">&uarr;</button><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> are licensed under the <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a> license.<br>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed under the <a href="https://opensource.org/licenses/MIT">MIT</a> license.<br>Built with the <a href="https://minicss.org">mini.css framework</a>.</p></footer></main></div></body></html>
</pre><button class="primary clipboard-copy">&#128203;&nbsp;Copy to clipboard</button></div></div><button class="scroll-to-top">&uarr;</button><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><img src="" style="vertical-align:text-bottom;padding-right:8px" width="20px" height="20px">Sponsored by <a href="https://www.digitalocean.com">DigitalOcean</a>.<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> are licensed under the <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a> license.<br>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed under the <a href="https://opensource.org/licenses/MIT">MIT</a> license.<br>Built with the <a href="https://minicss.org">mini.css framework</a>.</p></footer></main></div></body></html>