Travis build: 1313

This commit is contained in:
30secondsofcode
2019-07-20 09:46:25 +00:00
parent a4b831fe82
commit ce08cc1234
5 changed files with 8 additions and 5 deletions

View File

@ -4531,11 +4531,11 @@ isWeekday(); // true (if current date is 2019-07-19)
Results in a boolean representation of a specific date. Results in a boolean representation of a specific date.
Pass the specific date object firstly. Pass the specific date object firstly.
Use `Date.getDay()` to check weekend then return a boolean. Use `Date.getDay()` to check weekend based on the day being returned as 0 - 6 using a modulo operation then return a boolean.
```js ```js
const isWeekend = (t = new Date()) => { const isWeekend = (t = new Date()) => {
return t.getDay() === 0 || t.getDay() === 6; return t.getDay() % 6 === 0;
}; };
``` ```
@ -4817,6 +4817,7 @@ const checkProp = (predicate, prop) => obj => !!predicate(obj[prop]);
const lengthIs4 = checkProp(l => l === 4, 'length'); const lengthIs4 = checkProp(l => l === 4, 'length');
lengthIs4([]); // false lengthIs4([]); // false
lengthIs4([1,2,3,4]); // true lengthIs4([1,2,3,4]); // true

View File

@ -139,8 +139,8 @@
<span class="token keyword">return</span> t<span class="token punctuation">.</span><span class="token function">getDay</span><span class="token punctuation">()</span> <span class="token operator">%</span> <span class="token number">6</span> <span class="token operator">!==</span> <span class="token number">0</span><span class="token punctuation">; <span class="token keyword">return</span> t<span class="token punctuation">.</span><span class="token function">getDay</span><span class="token punctuation">()</span> <span class="token operator">%</span> <span class="token number">6</span> <span class="token operator">!==</span> <span class="token number">0</span><span class="token punctuation">;
};</span> };</span>
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">isWeekday</span><span class="token punctuation">();</span> <span class="token comment">// true (if current date is 2019-07-19)</span> </pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">isWeekday</span><span class="token punctuation">();</span> <span class="token comment">// true (if current date is 2019-07-19)</span>
</pre></div><div class="card code-card"><div class="corner beginner" aria-label="beginner" title="beginner"></div><div class="section card-content"><h4 id="isweekend">isWeekend</h4><p>Results in a boolean representation of a specific date.</p><p>Pass the specific date object firstly. Use <code>Date.getDay()</code> to check weekend then return a boolean.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> isWeekend <span class="token operator">=</span> <span class="token punctuation">(</span>t <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">())</span> <span class="token operator">=></span> <span class="token punctuation">{</span> </pre></div><div class="card code-card"><div class="corner beginner" aria-label="beginner" title="beginner"></div><div class="section card-content"><h4 id="isweekend">isWeekend</h4><p>Results in a boolean representation of a specific date.</p><p>Pass the specific date object firstly. Use <code>Date.getDay()</code> to check weekend based on the day being returned as 0 - 6 using a modulo operation then return a boolean.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> isWeekend <span class="token operator">=</span> <span class="token punctuation">(</span>t <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">())</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> t<span class="token punctuation">.</span><span class="token function">getDay</span><span class="token punctuation">()</span> <span class="token operator">===</span> <span class="token number">0</span> <span class="token operator">||</span> t<span class="token punctuation">.</span><span class="token function">getDay</span><span class="token punctuation">()</span> <span class="token operator">===</span> <span class="token number">6</span><span class="token punctuation">; <span class="token keyword">return</span> t<span class="token punctuation">.</span><span class="token function">getDay</span><span class="token punctuation">()</span> <span class="token operator">%</span> <span class="token number">6</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">;
};</span> };</span>
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">isWeekend</span><span class="token punctuation">();</span> <span class="token comment">// 2018-10-19 (if current date is 2018-10-18)</span> </pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">isWeekend</span><span class="token punctuation">();</span> <span class="token comment">// 2018-10-19 (if current date is 2018-10-18)</span>
</pre></div><div class="card code-card"><div class="corner beginner" aria-label="beginner" title="beginner"></div><div class="section card-content"><h4 id="maxdate">maxDate</h4><p>Returns the maximum of the given dates.</p><p>Use the ES6 spread syntax with <code>Math.max</code> to find the maximum date value, <code>new Date()</code> to convert it to a <code>Date</code> object.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">maxDate</span> <span class="token operator">=</span> dates <span class="token operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span>Math<span class="token punctuation">.</span><span class="token function">max</span><span class="token punctuation">(</span><span class="token operator">...</span>dates<span class="token punctuation">));</span> </pre></div><div class="card code-card"><div class="corner beginner" aria-label="beginner" title="beginner"></div><div class="section card-content"><h4 id="maxdate">maxDate</h4><p>Returns the maximum of the given dates.</p><p>Use the ES6 spread syntax with <code>Math.max</code> to find the maximum date value, <code>new Date()</code> to convert it to a <code>Date</code> object.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">maxDate</span> <span class="token operator">=</span> dates <span class="token operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span>Math<span class="token punctuation">.</span><span class="token function">max</span><span class="token punctuation">(</span><span class="token operator">...</span>dates<span class="token punctuation">));</span>

View File

@ -158,6 +158,7 @@ console<span class="token punctuation">.</span><span class="token function">log<
<span class="token keyword">const</span> lengthIs4 <span class="token operator">=</span> <span class="token function">checkProp</span><span class="token punctuation">(</span>l <span class="token operator">=></span> l <span class="token operator">===</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'length'</span><span class="token punctuation">);</span> <span class="token keyword">const</span> lengthIs4 <span class="token operator">=</span> <span class="token function">checkProp</span><span class="token punctuation">(</span>l <span class="token operator">=></span> l <span class="token operator">===</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'length'</span><span class="token punctuation">);</span>
<span class="token function">lengthIs4</span><span class="token punctuation">([]);</span> <span class="token comment">// false</span> <span class="token function">lengthIs4</span><span class="token punctuation">([]);</span> <span class="token comment">// false</span>
<span class="token function">lengthIs4</span><span class="token punctuation">([</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">]);</span> <span class="token comment">// true</span> <span class="token function">lengthIs4</span><span class="token punctuation">([</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">]);</span> <span class="token comment">// true</span>

View File

@ -23,6 +23,7 @@ const checkProp = (predicate, prop) => obj => !!predicate(obj[prop]);
const lengthIs4 = checkProp(l => l === 4, 'length'); const lengthIs4 = checkProp(l => l === 4, 'length');
lengthIs4([]); // false lengthIs4([]); // false
lengthIs4([1,2,3,4]); // true lengthIs4([1,2,3,4]); // true

View File

@ -662,7 +662,7 @@ const isWeekday = (t = new Date()) => {
return t.getDay() % 6 !== 0; return t.getDay() % 6 !== 0;
}; };
const isWeekend = (t = new Date()) => { const isWeekend = (t = new Date()) => {
return t.getDay() === 0 || t.getDay() === 6; return t.getDay() % 6 === 0;
}; };
const isWritableStream = val => const isWritableStream = val =>
val !== null && val !== null &&