Update formatting
This commit is contained in:
@ -7,9 +7,9 @@ lastUpdated: 2021-10-13T19:29:39+02:00
|
|||||||
|
|
||||||
Converts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified.
|
Converts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified.
|
||||||
|
|
||||||
- Use `Array.prototype.join(delimiter)` to combine all the names in `columns` to create the first row.
|
- Use `Array.prototype.join()` to combine all the names in `columns` to create the first row, using the provided `delimiter`.
|
||||||
- Use `Array.prototype.map()` and `Array.prototype.reduce()` to create a row for each object. Substitute non-existent values with empty strings and only mapping values in `columns`.
|
- Use `Array.prototype.map()` and `Array.prototype.reduce()` to create a row for each object. Substitute non-existent values with empty strings and only mapping values in `columns`.
|
||||||
- Use `Array.prototype.join('\n')` to combine all rows into a string.
|
- Use `Array.prototype.join()` to combine all rows into a string, separating each row with a newline (`\n`).
|
||||||
- Omit the third argument, `delimiter`, to use a default delimiter of `','`.
|
- Omit the third argument, `delimiter`, to use a default delimiter of `','`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -7,8 +7,8 @@ lastUpdated: 2020-11-03T21:55:08+02:00
|
|||||||
|
|
||||||
Converts a 2D array to a comma-separated values (CSV) string.
|
Converts a 2D array to a comma-separated values (CSV) string.
|
||||||
|
|
||||||
- Use `Array.prototype.map()` and `Array.prototype.join(delimiter)` to combine individual 1D arrays (rows) into strings.
|
- Use `Array.prototype.map()` and `Array.prototype.join()` to combine individual 1D arrays (rows) into strings, using the provided `delimiter`.
|
||||||
- Use `Array.prototype.join('\n')` to combine all rows into a CSV string, separating each row with a newline.
|
- Use `Array.prototype.join()` to combine all rows into a CSV string, separating each row with a newline (`\n`).
|
||||||
- Omit the second argument, `delimiter`, to use a default delimiter of `,`.
|
- Omit the second argument, `delimiter`, to use a default delimiter of `,`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -8,7 +8,7 @@ lastUpdated: 2020-11-01T20:50:57+02:00
|
|||||||
Capitalizes the first letter of a string.
|
Capitalizes the first letter of a string.
|
||||||
|
|
||||||
- Use array destructuring and `String.prototype.toUpperCase()` to capitalize the first letter of the string.
|
- Use array destructuring and `String.prototype.toUpperCase()` to capitalize the first letter of the string.
|
||||||
- Use `Array.prototype.join('')` to combine the capitalized `first` with the `...rest` of the characters.
|
- Use `Array.prototype.join()` to combine the capitalized `first` with the `...rest` of the characters.
|
||||||
- Omit the `lowerRest` argument to keep the rest of the string intact, or set it to `true` to convert to lowercase.
|
- Omit the `lowerRest` argument to keep the rest of the string intact, or set it to `true` to convert to lowercase.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -7,7 +7,7 @@ lastUpdated: 2020-11-01T20:50:57+02:00
|
|||||||
|
|
||||||
Decapitalizes the first letter of a string.
|
Decapitalizes the first letter of a string.
|
||||||
|
|
||||||
- Use array destructuring and `String.prototype.toLowerCase()` to decapitalize first letter, `...rest` to get array of characters after first letter and then `Array.prototype.join('')` to make it a string again.
|
- Use array destructuring and `String.prototype.toLowerCase()` to decapitalize first letter, `...rest` to get array of characters after first letter and then `Array.prototype.join()` to make it a string again.
|
||||||
- Omit the `upperRest` argument to keep the rest of the string intact, or set it to `true` to convert to uppercase.
|
- Omit the `upperRest` argument to keep the rest of the string intact, or set it to `true` to convert to uppercase.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user