@stacksjs/strings 0.75.118 → 0.75.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/csv.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /** RFC 4180 escaping, CRLF lines and optional UTF-8 BOM. Numeric negatives stay numeric. */
2
+ export declare function csvCell(value: unknown, options?: CsvOptions): string;
3
+ export declare function toCsv(header: readonly string[], rows: readonly (readonly unknown[])[], options?: CsvOptions): string;
4
+ export declare interface CsvOptions {
5
+ spreadsheetSafe?: boolean
6
+ bom?: boolean
7
+ }
package/dist/csv.js ADDED
@@ -0,0 +1,2 @@
1
+ export function csvCell(value,options={}){if(value===null||value===void 0)return"";let text=String(value);if(options.spreadsheetSafe!==!1&&typeof value==="string"&&/^[\s\u0000-\u001F]*[=+@-]/.test(text))text=`'${text}`;return/[",\r\n]/.test(text)?`"${text.replace(/"/g,'""')}"`:text}export function toCsv(header,rows,options={}){return(options.bom?"\uFEFF":"")+[header,...rows].map((row)=>row.map((cell)=>csvCell(cell,options)).join(",")).join(`\r
2
+ `)}
package/dist/string.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './pluralize';
5
5
  export * from './slug';
6
6
  export * from './utils';
7
7
  export * from './validators';
8
+ export * from './csv';
package/dist/string.js CHANGED
@@ -1 +1 @@
1
- export*from"./case";export*from"./helpers";export*from"./macro";export*from"./pluralize";export*from"./slug";export*from"./utils";export*from"./validators";
1
+ export*from"./case";export*from"./helpers";export*from"./macro";export*from"./pluralize";export*from"./slug";export*from"./utils";export*from"./validators";export*from"./csv";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/strings",
3
3
  "type": "module",
4
- "version": "0.75.118",
4
+ "version": "0.75.119",
5
5
  "description": "The Stacks string utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -69,9 +69,9 @@
69
69
  "prepublishOnly": "bun run build"
70
70
  },
71
71
  "devDependencies": {
72
- "@stacksjs/alias": "0.75.118",
72
+ "@stacksjs/alias": "0.75.119",
73
73
  "better-dx": "^0.2.24",
74
- "@stacksjs/types": "0.75.118"
74
+ "@stacksjs/types": "0.75.119"
75
75
  },
76
76
  "sideEffects": false
77
77
  }