You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# export-to-csv | Export to CSV Mini Library
2
2
3
-
Small, simple and single purpose. Zero dependencies, functionally inspired and fairly welltyped.
3
+
Small, simple, and single purpose. Zero dependencies, functionally inspired, and fairly well-typed.
4
4
5
-
If you're looking for a fully CSVcompliant, consistently maintained, whole-package library, I'd recommend looking elsewhere! (see [alternatives](#alternatives) section below)
5
+
If you're looking for a fully CSV-compliant, consistently maintained, whole-package library, I'd recommend looking elsewhere! (see [alternatives](#alternatives) section below)
6
6
7
7
If you want a lightweight, stable, easy-to-use basic CSV generation and download library, feel free to install.
|`fieldSeparator`|`","`|`string`| Defines the field separator character |
102
-
|`filename`|`"generated"`|`string`| Sets the name of the file creates from the `download` function |
103
-
|`quoteStrings`|`false`|`boolean`| Determines whether or not to quote strings (using `quoteCharacter`'s value). Whether or not this is set, `\r`, `\n`, and `fieldSeparator` will be quoted. |
104
-
|`quoteCharacter`|`'"'`|`string`| Sets the quote character to use. |
105
-
|`decimalSeparator`|`"."`|`string`| Defines the decimal separator character (default is .). If set to "locale", it uses the [languagesensitive representation of the number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString). |
106
-
|`showTitle`|`false`|`boolean`| Sets whether or not to add the value of `title` to the start of the CSV. (This is not supported by all CSV readers) |
107
-
|`title`|`"My Generated Report"`|`string`| The title to display as the first line of the CSV file. (This **is not** the name of the file [see `filename`]) |
108
-
|`showColumnHeaders`|`true`|`boolean`| Determines if columns should have headers. When set to `false`, the first row of the CSV will be data. |
109
-
|`columnHeaders`|`[]`|`Array<string \| {key: string, displayLabel: string}>`|**Use this option if column/header order is important!** Determines the headers to use as the first line of the CSV data. If the item is a `string`, it will be used for lookup in your collection AND as the header label. If the item is an object, `key` will be used for lookup and `displayLabel` will be used as the header label. |
110
-
|`useKeysAsHeaders`|`false`|`boolean`| If set, the CSV will use the key names in your collection as headers. **Warning: `headers` recommended for large collections. If set, it'll override the `headers` option. Column/header order also not guaranteed. Use `headers` only if order is important!**|
111
-
|`boolDisplay`|`{true: "TRUE", false: "FALSE"}`|`{true: string, false: string}`| Determines how to display boolean values in the CSV. **This only works for `true` and `false`. `1` and `0` will not be coerced and will display as `1` and `0`.**|
112
-
|`useBom`|`true`|`boolean`| Adds a [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark) which is required by Excel to display CSVs, despite is not being necessary with UTF-8 🤷♂️ |
113
-
|`useTextFile`|`false`|`boolean`| Will download the file as `text/plain` instead of `text/csv` and use a `.txt` vs `.csv` file-extension. |
|`fieldSeparator`|`","`|`string`| Defines the field separator character |
102
+
|`filename`|`"generated"`|`string`| Sets the name of the file created from the `download` function|
103
+
|`quoteStrings`|`false`|`boolean`| Determines whether or not to quote strings (using `quoteCharacter`'s value). Whether or not this is set, `\r`, `\n`, and `fieldSeparator` will be quoted. |
104
+
|`quoteCharacter`|`'"'`|`string`| Sets the quote character to use. |
105
+
|`decimalSeparator`|`"."`|`string`| Defines the decimal separator character (default is .). If set to "locale", it uses the [language-sensitive representation of the number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString).|
106
+
|`showTitle`|`false`|`boolean`| Sets whether or not to add the value of `title` to the start of the CSV. (This is not supported by all CSV readers) |
107
+
|`title`|`"My Generated Report"`|`string`| The title to display as the first line of the CSV file. (This **is not** the name of the file [see `filename`]) |
108
+
|`showColumnHeaders`|`true`|`boolean`| Determines if columns should have headers. When set to `false`, the first row of the CSV will be data. |
109
+
|`columnHeaders`|`[]`|`Array<string \| {key: string, displayLabel: string}>`|**Use this option if column/header order is important!** Determines the headers to use as the first line of the CSV data. If the item is a `string`, it will be used for lookup in your collection AND as the header label. If the item is an object, `key` will be used for lookup, and `displayLabel` will be used as the header label. |
110
+
|`useKeysAsHeaders`|`false`|`boolean`| If set, the CSV will use the key names in your collection as headers. **Warning: `headers` recommended for large collections. If set, it'll override the `headers` option. Column/header order also not guaranteed. Use `headers` only if order is important!**|
111
+
|`boolDisplay`|`{true: "TRUE", false: "FALSE"}`|`{true: string, false: string}`| Determines how to display boolean values in the CSV. **This only works for `true` and `false`. `1` and `0` will not be coerced and will display as `1` and `0`.**|
112
+
|`useBom`|`true`|`boolean`| Adds a [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark) which is required by Excel to display CSVs, despite it not being necessary with UTF-8 🤷♂️|
113
+
|`useTextFile`|`false`|`boolean`| Will download the file as `text/plain` instead of `text/csv` and use a `.txt` vs `.csv` fileextension.|
114
114
115
115
# Alternatives
116
116
@@ -121,7 +121,7 @@ As mentioned above, this library is intentionally small and was designed to solv
121
121
122
122
# Thanks!
123
123
124
-
This library was originally based off of[this library](https://github.com/javiertelioz/angular2-csv) by Javier Telio
124
+
This library was originally based on[this library](https://github.com/javiertelioz/angular2-csv) by Javier Telio
0 commit comments