@byjohann/utils
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -5,5 +5,10 @@ /** | ||
*/ | ||
declare function createCsv<T extends Record<string, any>>(data: T[], columns: (keyof T)[], | ||
/** @default ',' */ | ||
delimiter?: string): string; | ||
declare function createCSV<T extends Record<string, unknown>>(data: T[], columns: (keyof T)[], options?: { | ||
/** @default ',' */ | ||
delimiter?: string; | ||
/** @default true */ | ||
includeHeaders?: boolean; | ||
/** @default false */ | ||
quoteAll?: boolean; | ||
}): string; | ||
/** | ||
@@ -15,4 +20,4 @@ * Escapes a value for a CSV string. | ||
*/ | ||
declare function escapeCsvValue(value: unknown): string; | ||
declare function escapeCSVValue(value: unknown): string; | ||
export { createCsv, escapeCsvValue }; | ||
export { createCSV, escapeCSVValue }; |
export { MaybeArray, toArray } from './array.js'; | ||
export { createCsv, escapeCsvValue } from './csv.js'; | ||
export { createCSV, escapeCSVValue } from './csv.js'; | ||
export { tryParseJSON } from './json.js'; | ||
@@ -4,0 +4,0 @@ export { interopDefault } from './module.js'; |
{ | ||
"name": "@byjohann/utils", | ||
"type": "module", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"packageManager": "pnpm@9.5.0", | ||
@@ -6,0 +6,0 @@ "description": "A collection of utilities for my projects", |
@@ -36,3 +36,3 @@ # @byjohann/utils | ||
#### `createCsv` | ||
#### `createCSV` | ||
@@ -42,11 +42,17 @@ Converts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified. | ||
```ts | ||
declare function createCsv<T extends Record<string, any>>( | ||
declare function createCSV<T extends Record<string, unknown>>( | ||
data: T[], | ||
columns: (keyof T)[], | ||
/** @default ',' */ | ||
delimiter?: string | ||
options?: { | ||
/** @default ',' */ | ||
delimiter?: string | ||
/** @default true */ | ||
includeHeaders?: boolean | ||
/** @default false */ | ||
quoteAll?: boolean | ||
} | ||
): string | ||
``` | ||
#### `escapeCsvValue` | ||
#### `escapeCSVValue` | ||
@@ -59,3 +65,3 @@ Escapes a value for a CSV string. | ||
```ts | ||
declare function escapeCsvValue(value: unknown): string | ||
declare function escapeCSVValue(value: unknown): string | ||
``` | ||
@@ -62,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22086
298
223