legal-markdown-js 0.1.0

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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -0
  3. package/dist/browser.d.ts +87 -0
  4. package/dist/browser.d.ts.map +1 -0
  5. package/dist/browser.js +157 -0
  6. package/dist/browser.js.map +1 -0
  7. package/dist/cli/index.d.ts +34 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +221 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/service.d.ts +128 -0
  12. package/dist/cli/service.d.ts.map +1 -0
  13. package/dist/cli/service.js +284 -0
  14. package/dist/cli/service.js.map +1 -0
  15. package/dist/constants/index.d.ts +229 -0
  16. package/dist/constants/index.d.ts.map +1 -0
  17. package/dist/constants/index.js +232 -0
  18. package/dist/constants/index.js.map +1 -0
  19. package/dist/core/exporters/metadata-exporter.d.ts +104 -0
  20. package/dist/core/exporters/metadata-exporter.d.ts.map +1 -0
  21. package/dist/core/exporters/metadata-exporter.js +201 -0
  22. package/dist/core/exporters/metadata-exporter.js.map +1 -0
  23. package/dist/core/index.d.ts +40 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +56 -0
  26. package/dist/core/index.js.map +1 -0
  27. package/dist/core/parsers/yaml-parser.d.ts +149 -0
  28. package/dist/core/parsers/yaml-parser.d.ts.map +1 -0
  29. package/dist/core/parsers/yaml-parser.js +321 -0
  30. package/dist/core/parsers/yaml-parser.js.map +1 -0
  31. package/dist/core/processors/clause-processor.d.ts +74 -0
  32. package/dist/core/processors/clause-processor.d.ts.map +1 -0
  33. package/dist/core/processors/clause-processor.js +213 -0
  34. package/dist/core/processors/clause-processor.js.map +1 -0
  35. package/dist/core/processors/date-processor.d.ts +90 -0
  36. package/dist/core/processors/date-processor.d.ts.map +1 -0
  37. package/dist/core/processors/date-processor.js +336 -0
  38. package/dist/core/processors/date-processor.js.map +1 -0
  39. package/dist/core/processors/header-processor.d.ts +104 -0
  40. package/dist/core/processors/header-processor.d.ts.map +1 -0
  41. package/dist/core/processors/header-processor.js +585 -0
  42. package/dist/core/processors/header-processor.js.map +1 -0
  43. package/dist/core/processors/import-processor.d.ts +116 -0
  44. package/dist/core/processors/import-processor.d.ts.map +1 -0
  45. package/dist/core/processors/import-processor.js +236 -0
  46. package/dist/core/processors/import-processor.js.map +1 -0
  47. package/dist/core/processors/mixin-processor.d.ts +93 -0
  48. package/dist/core/processors/mixin-processor.d.ts.map +1 -0
  49. package/dist/core/processors/mixin-processor.js +378 -0
  50. package/dist/core/processors/mixin-processor.js.map +1 -0
  51. package/dist/core/processors/reference-processor.d.ts +115 -0
  52. package/dist/core/processors/reference-processor.d.ts.map +1 -0
  53. package/dist/core/processors/reference-processor.js +273 -0
  54. package/dist/core/processors/reference-processor.js.map +1 -0
  55. package/dist/errors/index.d.ts +234 -0
  56. package/dist/errors/index.d.ts.map +1 -0
  57. package/dist/errors/index.js +267 -0
  58. package/dist/errors/index.js.map +1 -0
  59. package/dist/extensions/batch-processor.d.ts +197 -0
  60. package/dist/extensions/batch-processor.d.ts.map +1 -0
  61. package/dist/extensions/batch-processor.js +392 -0
  62. package/dist/extensions/batch-processor.js.map +1 -0
  63. package/dist/extensions/formatters/index.d.ts +99 -0
  64. package/dist/extensions/formatters/index.d.ts.map +1 -0
  65. package/dist/extensions/formatters/index.js +128 -0
  66. package/dist/extensions/formatters/index.js.map +1 -0
  67. package/dist/extensions/index.d.ts +53 -0
  68. package/dist/extensions/index.d.ts.map +1 -0
  69. package/dist/extensions/index.js +71 -0
  70. package/dist/extensions/index.js.map +1 -0
  71. package/dist/extensions/latex-parser.d.ts +111 -0
  72. package/dist/extensions/latex-parser.d.ts.map +1 -0
  73. package/dist/extensions/latex-parser.js +563 -0
  74. package/dist/extensions/latex-parser.js.map +1 -0
  75. package/dist/extensions/rst-parser.d.ts +112 -0
  76. package/dist/extensions/rst-parser.d.ts.map +1 -0
  77. package/dist/extensions/rst-parser.js +268 -0
  78. package/dist/extensions/rst-parser.js.map +1 -0
  79. package/dist/extensions/template-loops.d.ts +61 -0
  80. package/dist/extensions/template-loops.d.ts.map +1 -0
  81. package/dist/extensions/template-loops.js +418 -0
  82. package/dist/extensions/template-loops.js.map +1 -0
  83. package/dist/extensions/utilities/index.d.ts +114 -0
  84. package/dist/extensions/utilities/index.d.ts.map +1 -0
  85. package/dist/extensions/utilities/index.js +137 -0
  86. package/dist/extensions/utilities/index.js.map +1 -0
  87. package/dist/extensions/validators/index.d.ts +65 -0
  88. package/dist/extensions/validators/index.d.ts.map +1 -0
  89. package/dist/extensions/validators/index.js +88 -0
  90. package/dist/extensions/validators/index.js.map +1 -0
  91. package/dist/generators/html-generator.d.ts +184 -0
  92. package/dist/generators/html-generator.d.ts.map +1 -0
  93. package/dist/generators/html-generator.js +361 -0
  94. package/dist/generators/html-generator.js.map +1 -0
  95. package/dist/generators/pdf-generator.d.ts +165 -0
  96. package/dist/generators/pdf-generator.d.ts.map +1 -0
  97. package/dist/generators/pdf-generator.js +275 -0
  98. package/dist/generators/pdf-generator.js.map +1 -0
  99. package/dist/helpers/date-helpers.d.ts +216 -0
  100. package/dist/helpers/date-helpers.d.ts.map +1 -0
  101. package/dist/helpers/date-helpers.js +402 -0
  102. package/dist/helpers/date-helpers.js.map +1 -0
  103. package/dist/helpers/index.d.ts +87 -0
  104. package/dist/helpers/index.d.ts.map +1 -0
  105. package/dist/helpers/index.js +149 -0
  106. package/dist/helpers/index.js.map +1 -0
  107. package/dist/helpers/number-helpers.d.ts +269 -0
  108. package/dist/helpers/number-helpers.d.ts.map +1 -0
  109. package/dist/helpers/number-helpers.js +406 -0
  110. package/dist/helpers/number-helpers.js.map +1 -0
  111. package/dist/helpers/string-helpers.d.ts +391 -0
  112. package/dist/helpers/string-helpers.d.ts.map +1 -0
  113. package/dist/helpers/string-helpers.js +549 -0
  114. package/dist/helpers/string-helpers.js.map +1 -0
  115. package/dist/index.d.ts +229 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +384 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/legal-markdown.umd.min.js +2 -0
  120. package/dist/legal-markdown.umd.min.js.LICENSE.txt +14 -0
  121. package/dist/legal-markdown.umd.min.js.map +1 -0
  122. package/dist/lib/index.d.ts +150 -0
  123. package/dist/lib/index.d.ts.map +1 -0
  124. package/dist/lib/index.js +265 -0
  125. package/dist/lib/index.js.map +1 -0
  126. package/dist/parsers/content-detector.d.ts +131 -0
  127. package/dist/parsers/content-detector.d.ts.map +1 -0
  128. package/dist/parsers/content-detector.js +220 -0
  129. package/dist/parsers/content-detector.js.map +1 -0
  130. package/dist/parsers/fallback-parsers.d.ts +14 -0
  131. package/dist/parsers/fallback-parsers.d.ts.map +1 -0
  132. package/dist/parsers/fallback-parsers.js +188 -0
  133. package/dist/parsers/fallback-parsers.js.map +1 -0
  134. package/dist/parsers/implementations/pandoc-native.d.ts +13 -0
  135. package/dist/parsers/implementations/pandoc-native.d.ts.map +1 -0
  136. package/dist/parsers/implementations/pandoc-native.js +63 -0
  137. package/dist/parsers/implementations/pandoc-native.js.map +1 -0
  138. package/dist/parsers/implementations/pandoc-wasm.d.ts +14 -0
  139. package/dist/parsers/implementations/pandoc-wasm.d.ts.map +1 -0
  140. package/dist/parsers/implementations/pandoc-wasm.js +64 -0
  141. package/dist/parsers/implementations/pandoc-wasm.js.map +1 -0
  142. package/dist/parsers/pandoc-factory.d.ts +97 -0
  143. package/dist/parsers/pandoc-factory.d.ts.map +1 -0
  144. package/dist/parsers/pandoc-factory.js +146 -0
  145. package/dist/parsers/pandoc-factory.js.map +1 -0
  146. package/dist/parsers/pandoc-loader.d.ts +24 -0
  147. package/dist/parsers/pandoc-loader.d.ts.map +1 -0
  148. package/dist/parsers/pandoc-loader.js +124 -0
  149. package/dist/parsers/pandoc-loader.js.map +1 -0
  150. package/dist/parsers/pandoc-parser.d.ts +27 -0
  151. package/dist/parsers/pandoc-parser.d.ts.map +1 -0
  152. package/dist/parsers/pandoc-parser.js +3 -0
  153. package/dist/parsers/pandoc-parser.js.map +1 -0
  154. package/dist/styles/default.css +125 -0
  155. package/dist/styles/headers.css +146 -0
  156. package/dist/styles/highlight.css +171 -0
  157. package/dist/tracking/field-tracker.d.ts +206 -0
  158. package/dist/tracking/field-tracker.d.ts.map +1 -0
  159. package/dist/tracking/field-tracker.js +247 -0
  160. package/dist/tracking/field-tracker.js.map +1 -0
  161. package/dist/types.d.ts +186 -0
  162. package/dist/types.d.ts.map +1 -0
  163. package/dist/types.js +33 -0
  164. package/dist/types.js.map +1 -0
  165. package/dist/utils/logger.d.ts +107 -0
  166. package/dist/utils/logger.d.ts.map +1 -0
  167. package/dist/utils/logger.js +122 -0
  168. package/dist/utils/logger.js.map +1 -0
  169. package/dist/web/bundle-standalone.js +28 -0
  170. package/dist/web/bundle.js +17 -0
  171. package/dist/web/index.html +1465 -0
  172. package/dist/web/legal-markdown.umd.min.js +2 -0
  173. package/dist/web/standalone.html +390 -0
  174. package/dist/web/styles.css +874 -0
  175. package/package.json +118 -0
@@ -0,0 +1,391 @@
1
+ /**
2
+ * @fileoverview String Manipulation and Formatting Helpers
3
+ *
4
+ * This module provides comprehensive string manipulation utilities designed
5
+ * for legal document processing. It includes functions for case conversion,
6
+ * text formatting, string validation, and various text processing operations
7
+ * commonly needed in legal document generation and formatting.
8
+ *
9
+ * Features:
10
+ * - Case conversion (capitalize, title case, upper, lower)
11
+ * - String formatting (camelCase, kebab-case, snake_case, PascalCase)
12
+ * - Text manipulation (truncate, clean, pad, pluralize)
13
+ * - String validation and search (contains, replace)
14
+ * - Name processing (initials extraction)
15
+ * - Safe handling of null/undefined values
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { capitalize, titleCase, pluralize } from './string-helpers';
20
+ *
21
+ * // Case conversion
22
+ * const title = titleCase('legal document processing'); // \"Legal Document Processing\"\n *\n * // Text formatting\n * const name = capitalize('john doe'); // \"John doe\"\n *\n * // Pluralization\n * const items = pluralize('contract', 5); // \"contracts\"\n * ```\n */
23
+ /**
24
+ * Capitalizes the first letter of a string
25
+ *
26
+ * Converts the first character to uppercase and the rest to lowercase.
27
+ * Safely handles null and undefined values by returning an empty string.
28
+ *
29
+ * @param {string | undefined | null} str - The string to capitalize
30
+ * @returns {string} The capitalized string, or empty string if input is null/undefined
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * capitalize('hello world'); // "Hello world"
35
+ * capitalize('HELLO WORLD'); // "Hello world"
36
+ * capitalize('hELLO wORLD'); // "Hello world"
37
+ * capitalize(''); // ""
38
+ * capitalize(null); // ""
39
+ * capitalize(undefined); // ""
40
+ * ```
41
+ */
42
+ export declare function capitalize(str: string | undefined | null): string;
43
+ /**
44
+ * Capitalizes the first letter of each word in a string
45
+ *
46
+ * Applies the capitalize function to each word separated by spaces,
47
+ * useful for formatting names, titles, and other multi-word strings.
48
+ *
49
+ * @param {string | undefined | null} str - The string to capitalize
50
+ * @returns {string} The string with each word capitalized
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * capitalizeWords('john doe'); // "John Doe"
55
+ * capitalizeWords('legal document'); // "Legal Document"
56
+ * capitalizeWords('HELLO WORLD'); // "Hello World"
57
+ * capitalizeWords('mixed CaSe WoRdS'); // "Mixed Case Words"
58
+ * capitalizeWords(''); // ""
59
+ * capitalizeWords(null); // ""
60
+ * ```
61
+ */
62
+ export declare function capitalizeWords(str: string | undefined | null): string;
63
+ /**
64
+ * Converts a string to uppercase
65
+ *
66
+ * Safely converts all characters in the string to uppercase,
67
+ * handling null and undefined values gracefully.
68
+ *
69
+ * @param {string | undefined | null} str - The string to convert
70
+ * @returns {string} The uppercase string, or empty string if input is null/undefined
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * upper('hello world'); // "HELLO WORLD"
75
+ * upper('Mixed Case'); // "MIXED CASE"
76
+ * upper(''); // ""
77
+ * upper(null); // ""
78
+ * upper(undefined); // ""
79
+ * ```
80
+ */
81
+ export declare function upper(str: string | undefined | null): string;
82
+ /**
83
+ * Converts a string to lowercase
84
+ *
85
+ * Safely converts all characters in the string to lowercase,
86
+ * handling null and undefined values gracefully.
87
+ *
88
+ * @param {string | undefined | null} str - The string to convert
89
+ * @returns {string} The lowercase string, or empty string if input is null/undefined
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * lower('HELLO WORLD'); // "hello world"
94
+ * lower('Mixed Case'); // "mixed case"
95
+ * lower(''); // ""
96
+ * lower(null); // ""
97
+ * lower(undefined); // ""
98
+ * ```
99
+ */
100
+ export declare function lower(str: string | undefined | null): string;
101
+ /**
102
+ * Converts a string to title case with proper handling of articles and prepositions
103
+ *
104
+ * Applies title case rules where the first and last words are always capitalized,
105
+ * and small words (articles, prepositions, conjunctions) are kept lowercase
106
+ * unless they appear at the beginning or end of the string.
107
+ *
108
+ * @param {string | undefined | null} str - The string to convert to title case
109
+ * @returns {string} The title-cased string
110
+ *
111
+ * Small words that remain lowercase: a, an, and, as, at, but, by, for, if, in,
112
+ * nor, of, on, or, so, the, to, up, yet
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * titleCase('the quick brown fox'); // "The Quick Brown Fox"
117
+ * titleCase('a tale of two cities'); // "A Tale of Two Cities"
118
+ * titleCase('for whom the bell tolls'); // "For Whom the Bell Tolls"
119
+ * titleCase('HELLO WORLD'); // "Hello World"
120
+ * titleCase(''); // ""
121
+ * titleCase(null); // ""
122
+ * ```
123
+ */
124
+ export declare function titleCase(str: string | undefined | null): string;
125
+ /**
126
+ * Converts a string to kebab-case format
127
+ *
128
+ * Transforms camelCase, PascalCase, or space-separated strings into
129
+ * kebab-case (lowercase with hyphens). Useful for URL slugs, CSS classes,
130
+ * and file names.
131
+ *
132
+ * @param {string | undefined | null} str - The string to convert
133
+ * @returns {string} The kebab-cased string
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * kebabCase('camelCaseString'); // "camel-case-string"
138
+ * kebabCase('PascalCaseString'); // "pascal-case-string"
139
+ * kebabCase('normal string'); // "normal-string"
140
+ * kebabCase('mixed_case string'); // "mixed-case-string"
141
+ * kebabCase(''); // ""
142
+ * kebabCase(null); // ""
143
+ * ```
144
+ */
145
+ export declare function kebabCase(str: string | undefined | null): string;
146
+ /**
147
+ * Converts a string to snake_case format
148
+ *
149
+ * Transforms camelCase, PascalCase, or space-separated strings into
150
+ * snake_case (lowercase with underscores). Commonly used for variable
151
+ * names, database fields, and API parameters.
152
+ *
153
+ * @param {string | undefined | null} str - The string to convert
154
+ * @returns {string} The snake_cased string
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * snakeCase('camelCaseString'); // "camel_case_string"
159
+ * snakeCase('PascalCaseString'); // "pascal_case_string"
160
+ * snakeCase('normal string'); // "normal_string"
161
+ * snakeCase('kebab-case-string'); // "kebab_case_string"
162
+ * snakeCase(''); // ""
163
+ * snakeCase(null); // ""
164
+ * ```
165
+ */
166
+ export declare function snakeCase(str: string | undefined | null): string;
167
+ /**
168
+ * Converts a string to camelCase format
169
+ *
170
+ * Transforms space-separated, hyphenated, or snake_case strings into
171
+ * camelCase where the first word is lowercase and subsequent words
172
+ * are capitalized. Commonly used for JavaScript variable names.
173
+ *
174
+ * @param {string | undefined | null} str - The string to convert
175
+ * @returns {string} The camelCased string
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * camelCase('normal string'); // "normalString"
180
+ * camelCase('kebab-case-string'); // "kebabCaseString"
181
+ * camelCase('snake_case_string'); // "snakeCaseString"
182
+ * camelCase('PascalCaseString'); // "pascalCaseString"
183
+ * camelCase(''); // ""
184
+ * camelCase(null); // ""
185
+ * ```
186
+ */
187
+ export declare function camelCase(str: string | undefined | null): string;
188
+ /**
189
+ * Converts a string to PascalCase format
190
+ *
191
+ * Transforms strings into PascalCase where the first letter of each word
192
+ * is capitalized and there are no spaces or separators. Commonly used
193
+ * for class names, constructor functions, and type names.
194
+ *
195
+ * @param {string | undefined | null} str - The string to convert
196
+ * @returns {string} The PascalCased string
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * pascalCase('normal string'); // "NormalString"
201
+ * pascalCase('kebab-case-string'); // "KebabCaseString"
202
+ * pascalCase('snake_case_string'); // "SnakeCaseString"
203
+ * pascalCase('camelCaseString'); // "CamelCaseString"
204
+ * pascalCase(''); // ""
205
+ * pascalCase(null); // ""
206
+ * ```
207
+ */
208
+ export declare function pascalCase(str: string | undefined | null): string;
209
+ /**
210
+ * Truncates a string to a specified length with optional suffix
211
+ *
212
+ * Shortens a string to the specified maximum length and appends a suffix
213
+ * (default: '...') if the string exceeds the limit. Useful for creating
214
+ * previews, summaries, or fitting text into constrained spaces.
215
+ *
216
+ * @param {string | undefined | null} str - The string to truncate
217
+ * @param {number} length - The maximum length of the result
218
+ * @param {string} suffix - The suffix to append when truncating (default: '...')
219
+ * @returns {string} The truncated string with suffix if needed
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * truncate('This is a long string', 10); // "This is a..."
224
+ * truncate('Short', 10); // "Short"
225
+ * truncate('This is a long string', 15, '…'); // "This is a long…"
226
+ * truncate('', 10); // ""
227
+ * truncate(null, 10); // ""
228
+ * ```
229
+ */
230
+ export declare function truncate(str: string | undefined | null, length: number, suffix?: string): string;
231
+ /**
232
+ * Removes extra whitespace and trims a string
233
+ *
234
+ * Collapses multiple consecutive whitespace characters into single spaces
235
+ * and removes leading/trailing whitespace. Useful for cleaning up user
236
+ * input or text from various sources.
237
+ *
238
+ * @param {string | undefined | null} str - The string to clean
239
+ * @returns {string} The cleaned string with normalized whitespace
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * clean(' hello world '); // "hello world"
244
+ * clean('\t\n text \r\n'); // "text"
245
+ * clean('normal spacing'); // "normal spacing"
246
+ * clean(''); // ""
247
+ * clean(null); // ""
248
+ * ```
249
+ */
250
+ export declare function clean(str: string | undefined | null): string;
251
+ /**
252
+ * Pluralizes a word based on count with optional custom plural form
253
+ *
254
+ * Returns the singular form if count is 1, otherwise returns the plural form.
255
+ * Can accept a custom plural form or will apply basic English pluralization
256
+ * rules automatically.
257
+ *
258
+ * @param {string} word - The singular form of the word
259
+ * @param {number} count - The count to determine singular/plural
260
+ * @param {string} [plural] - Optional custom plural form
261
+ * @returns {string} The appropriate singular or plural form
262
+ *
263
+ * Basic pluralization rules applied:
264
+ * - Words ending in 's', 'x', 'z', 'sh', 'ch' → add 'es'
265
+ * - Words ending in consonant + 'y' → change 'y' to 'ies'
266
+ * - All other words → add 's'
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * pluralize('cat', 1); // "cat"
271
+ * pluralize('cat', 2); // "cats"
272
+ * pluralize('box', 5); // "boxes"
273
+ * pluralize('city', 3); // "cities"
274
+ * pluralize('child', 2, 'children'); // "children"
275
+ * pluralize('person', 1, 'people'); // "person"
276
+ * pluralize('person', 3, 'people'); // "people"
277
+ * ```
278
+ */
279
+ export declare function pluralize(word: string, count: number, plural?: string): string;
280
+ /**
281
+ * Pads a string to a specified length from the start (left side)
282
+ *
283
+ * Adds padding characters to the beginning of a string until it reaches
284
+ * the specified length. Useful for formatting numbers, creating aligned
285
+ * text, or ensuring consistent string lengths.
286
+ *
287
+ * @param {string | undefined | null} str - The string to pad
288
+ * @param {number} length - The target length of the result
289
+ * @param {string} char - The character to use for padding (default: ' ')
290
+ * @returns {string} The padded string
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * padStart('42', 5); // " 42"
295
+ * padStart('42', 5, '0'); // "00042"
296
+ * padStart('hello', 8, '-'); // "---hello"
297
+ * padStart('toolong', 4); // "toolong" (no padding if already longer)
298
+ * padStart('', 3); // " "
299
+ * padStart(null, 5); // " "
300
+ * ```
301
+ */
302
+ export declare function padStart(str: string | undefined | null, length: number, char?: string): string;
303
+ /**
304
+ * Pads a string to a specified length from the end (right side)
305
+ *
306
+ * Adds padding characters to the end of a string until it reaches
307
+ * the specified length. Useful for creating aligned columns,
308
+ * formatting output, or ensuring consistent string lengths.
309
+ *
310
+ * @param {string | undefined | null} str - The string to pad
311
+ * @param {number} length - The target length of the result
312
+ * @param {string} char - The character to use for padding (default: ' ')
313
+ * @returns {string} The padded string
314
+ *
315
+ * @example
316
+ * ```typescript
317
+ * padEnd('42', 5); // "42 "
318
+ * padEnd('42', 5, '0'); // "42000"
319
+ * padEnd('hello', 8, '-'); // "hello---"
320
+ * padEnd('toolong', 4); // "toolong" (no padding if already longer)
321
+ * padEnd('', 3); // " "
322
+ * padEnd(null, 5); // " "
323
+ * ```
324
+ */
325
+ export declare function padEnd(str: string | undefined | null, length: number, char?: string): string;
326
+ /**
327
+ * Checks if a string contains a substring with optional case sensitivity
328
+ *
329
+ * Performs substring search with configurable case sensitivity.
330
+ * Useful for filtering, validation, and text analysis.
331
+ *
332
+ * @param {string | undefined | null} str - The string to search in
333
+ * @param {string} substring - The substring to search for
334
+ * @param {boolean} caseSensitive - Whether the search is case sensitive (default: false)
335
+ * @returns {boolean} True if the substring is found, false otherwise
336
+ *
337
+ * @example
338
+ * ```typescript
339
+ * contains('Hello World', 'hello'); // true (case insensitive)
340
+ * contains('Hello World', 'hello', true); // false (case sensitive)
341
+ * contains('Hello World', 'World'); // true
342
+ * contains('Hello World', 'xyz'); // false
343
+ * contains('', 'test'); // false
344
+ * contains(null, 'test'); // false
345
+ * contains('test', ''); // false
346
+ * ```
347
+ */
348
+ export declare function contains(str: string | undefined | null, substring: string, caseSensitive?: boolean): boolean;
349
+ /**
350
+ * Replaces all occurrences of a substring with a replacement string
351
+ *
352
+ * Performs global string replacement without using regular expressions.
353
+ * Useful for text processing, template substitution, and content cleanup.
354
+ *
355
+ * @param {string | undefined | null} str - The string to perform replacements on
356
+ * @param {string} search - The substring to search for
357
+ * @param {string} replace - The replacement string
358
+ * @returns {string} The string with all occurrences replaced
359
+ *
360
+ * @example
361
+ * ```typescript
362
+ * replaceAll('hello world hello', 'hello', 'hi'); // "hi world hi"
363
+ * replaceAll('a,b,c', ',', ' | '); // "a | b | c"
364
+ * replaceAll('test', 'x', 'y'); // "test" (no change)
365
+ * replaceAll('', 'x', 'y'); // ""
366
+ * replaceAll(null, 'x', 'y'); // ""
367
+ * ```
368
+ */
369
+ export declare function replaceAll(str: string | undefined | null, search: string, replace: string): string;
370
+ /**
371
+ * Extracts initials from a name or multi-word string
372
+ *
373
+ * Takes the first character of each word (separated by spaces) and
374
+ * combines them into uppercase initials. Useful for creating
375
+ * abbreviated representations of names or titles.
376
+ *
377
+ * @param {string | undefined | null} name - The name or string to extract initials from
378
+ * @returns {string} The initials in uppercase
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * initials('John Doe'); // "JD"
383
+ * initials('Mary Jane Watson'); // "MJW"
384
+ * initials('single'); // "S"
385
+ * initials('jean-claude van damme'); // "JVD" (hyphens treated as separators)
386
+ * initials(''); // ""
387
+ * initials(null); // ""
388
+ * ```
389
+ */
390
+ export declare function initials(name: string | undefined | null): string;
391
+ //# sourceMappingURL=string-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/string-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;iTAqBiT;AAEjT;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAGjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAMtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,GAAG,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