Travis build: 620

This commit is contained in:
30secondsofcode
2018-10-09 08:16:49 +00:00
parent 851f70ecf5
commit 17ebfaead0
2 changed files with 2 additions and 2 deletions

View File

@ -1767,7 +1767,7 @@ join(['pen', 'pineapple', 'apple', 'pen']); // "pen,pineapple,apple,pen"
Converts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified.
Use `Array.prototype.join(demiliter)` to combine all the names in `columns` to create the first row.
Use `Array.prototype.join(delimiter)` to combine all the names in `columns` to create the first row.
Use `Array.prototype.map()` and `Array.prototype.reduce()` to create a row for each object, substituting non-existent values with empty strings and only mapping values in `columns`.
Use `Array.prototype.join('\n')` to combine all rows into a string.
Omit the third argument, `delimiter`, to use a default delimiter of `,`.

View File

@ -266,7 +266,7 @@
</pre><label class="collapse">examples</label><pre class="section card-examples language-js"><span class="token function">join</span><span class="token punctuation">([</span><span class="token string">'pen'</span><span class="token punctuation">,</span> <span class="token string">'pineapple'</span><span class="token punctuation">,</span> <span class="token string">'apple'</span><span class="token punctuation">,</span> <span class="token string">'pen'</span><span class="token punctuation">],</span> <span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">'&amp;'</span><span class="token punctuation">);</span> <span class="token comment">// "pen,pineapple,apple&amp;pen"</span>
<span class="token function">join</span><span class="token punctuation">([</span><span class="token string">'pen'</span><span class="token punctuation">,</span> <span class="token string">'pineapple'</span><span class="token punctuation">,</span> <span class="token string">'apple'</span><span class="token punctuation">,</span> <span class="token string">'pen'</span><span class="token punctuation">],</span> <span class="token string">','</span><span class="token punctuation">);</span> <span class="token comment">// "pen,pineapple,apple,pen"</span>
<span class="token function">join</span><span class="token punctuation">([</span><span class="token string">'pen'</span><span class="token punctuation">,</span> <span class="token string">'pineapple'</span><span class="token punctuation">,</span> <span class="token string">'apple'</span><span class="token punctuation">,</span> <span class="token string">'pen'</span><span class="token punctuation">]);</span> <span class="token comment">// "pen,pineapple,apple,pen"</span>
</pre></div><div class="card code-card"><div class="corner advanced"></div><div class="section card-content"><h4 id="jsontocsv">JSONtoCSV</h4><p>Converts an array of objects to a comma-separated values (CSV) string that contains only the <code>columns</code> specified.</p><p>Use <code>Array.prototype.join(demiliter)</code> to combine all the names in <code>columns</code> to create the first row. Use <code>Array.prototype.map()</code> and <code>Array.prototype.reduce()</code> to create a row for each object, substituting non-existent values with empty strings and only mapping values in <code>columns</code>. Use <code>Array.prototype.join('\n')</code> to combine all rows into a string. Omit the third argument, <code>delimiter</code>, to use a default delimiter of <code>,</code>.</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> JSONtoCSV <span class="token operator">=</span> <span class="token punctuation">(</span>arr<span class="token punctuation">,</span> columns<span class="token punctuation">,</span> delimiter <span class="token operator">=</span> <span class="token string">','</span><span class="token punctuation">)</span> <span class="token operator">=></span>
</pre></div><div class="card code-card"><div class="corner advanced"></div><div class="section card-content"><h4 id="jsontocsv">JSONtoCSV</h4><p>Converts an array of objects to a comma-separated values (CSV) string that contains only the <code>columns</code> specified.</p><p>Use <code>Array.prototype.join(delimiter)</code> to combine all the names in <code>columns</code> to create the first row. Use <code>Array.prototype.map()</code> and <code>Array.prototype.reduce()</code> to create a row for each object, substituting non-existent values with empty strings and only mapping values in <code>columns</code>. Use <code>Array.prototype.join('\n')</code> to combine all rows into a string. Omit the third argument, <code>delimiter</code>, to use a default delimiter of <code>,</code>.</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> JSONtoCSV <span class="token operator">=</span> <span class="token punctuation">(</span>arr<span class="token punctuation">,</span> columns<span class="token punctuation">,</span> delimiter <span class="token operator">=</span> <span class="token string">','</span><span class="token punctuation">)</span> <span class="token operator">=></span>
<span class="token punctuation">[</span>
columns<span class="token punctuation">.</span><span class="token function">join</span><span class="token punctuation">(</span>delimiter<span class="token punctuation">),</span>
<span class="token operator">...</span>arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span>obj <span class="token operator">=></span>