@turndown/library 0.1.23 → 0.1.28
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/index.cjs +1355 -0
- package/dist/index.d.cts +2820 -0
- package/dist/index.d.ts +2820 -2
- package/dist/index.js +1190 -2
- package/package.json +3 -2
- package/dist/helpers/date/index.d.ts +0 -113
- package/dist/helpers/date/index.js +0 -171
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/index.js +0 -3
- package/dist/helpers/object/index.d.ts +0 -298
- package/dist/helpers/object/index.js +0 -540
- package/dist/helpers/string/index.d.ts +0 -258
- package/dist/helpers/string/index.js +0 -496
- package/dist/types/api/index.d.ts +0 -70
- package/dist/types/api/index.js +0 -53
- package/dist/types/auth/index.d.ts +0 -107
- package/dist/types/auth/index.js +0 -8
- package/dist/types/auth/routes.d.ts +0 -160
- package/dist/types/auth/routes.js +0 -1
- package/dist/types/base/index.d.ts +0 -200
- package/dist/types/base/index.js +0 -177
- package/dist/types/base/paging.types.d.ts +0 -47
- package/dist/types/base/paging.types.js +0 -1
- package/dist/types/checklist-template/index.d.ts +0 -48
- package/dist/types/checklist-template/index.js +0 -1
- package/dist/types/checklist-template/routes.d.ts +0 -85
- package/dist/types/checklist-template/routes.js +0 -1
- package/dist/types/company/index.d.ts +0 -22
- package/dist/types/company/index.js +0 -7
- package/dist/types/company/routes.d.ts +0 -100
- package/dist/types/company/routes.js +0 -1
- package/dist/types/damage-report/index.d.ts +0 -57
- package/dist/types/damage-report/index.js +0 -16
- package/dist/types/damage-report/routes.d.ts +0 -153
- package/dist/types/damage-report/routes.js +0 -1
- package/dist/types/errors/index.d.ts +0 -66
- package/dist/types/errors/index.js +0 -41
- package/dist/types/health/index.d.ts +0 -20
- package/dist/types/health/index.js +0 -1
- package/dist/types/health/routes.d.ts +0 -10
- package/dist/types/health/routes.js +0 -1
- package/dist/types/image/index.d.ts +0 -34
- package/dist/types/image/index.js +0 -11
- package/dist/types/image/routes.d.ts +0 -32
- package/dist/types/image/routes.js +0 -1
- package/dist/types/index.d.ts +0 -21
- package/dist/types/index.js +0 -21
- package/dist/types/inventory/index.d.ts +0 -124
- package/dist/types/inventory/index.js +0 -30
- package/dist/types/inventory/routes.d.ts +0 -109
- package/dist/types/inventory/routes.js +0 -1
- package/dist/types/job/index.d.ts +0 -7
- package/dist/types/job/index.js +0 -1
- package/dist/types/property/index.d.ts +0 -113
- package/dist/types/property/index.js +0 -25
- package/dist/types/property/routes.d.ts +0 -54
- package/dist/types/property/routes.js +0 -1
- package/dist/types/room/index.d.ts +0 -28
- package/dist/types/room/index.js +0 -17
- package/dist/types/room/routes.d.ts +0 -35
- package/dist/types/room/routes.js +0 -1
- package/dist/types/room-checklist/index.d.ts +0 -43
- package/dist/types/room-checklist/index.js +0 -1
- package/dist/types/room-checklist/routes.d.ts +0 -78
- package/dist/types/room-checklist/routes.js +0 -1
- package/dist/types/user/index.d.ts +0 -59
- package/dist/types/user/index.js +0 -20
- package/dist/types/user/routes.d.ts +0 -46
- package/dist/types/user/routes.js +0 -1
- package/dist/types/work-session/index.d.ts +0 -97
- package/dist/types/work-session/index.js +0 -18
- package/dist/types/work-session/routes.d.ts +0 -89
- package/dist/types/work-session/routes.js +0 -1
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* String utilities for common text manipulation tasks.
|
|
3
|
-
*/
|
|
4
|
-
import { TUSStateCode } from "@/types";
|
|
5
|
-
/**
|
|
6
|
-
* Adds commas to a number for thousands separators.
|
|
7
|
-
*
|
|
8
|
-
* @example formatNumber(1000) => '1,000'
|
|
9
|
-
* @example formatNumber('1234567') => '1,234,567'
|
|
10
|
-
* @example formatNumber(1234567.89) => '1,234,567.89'
|
|
11
|
-
*/
|
|
12
|
-
export declare const formatNumber: (value: string | number) => string;
|
|
13
|
-
export declare const normalCase: (str?: string) => string;
|
|
14
|
-
export declare const sentenceCase: (str?: string) => string;
|
|
15
|
-
export declare const upperCase: (str?: string) => string;
|
|
16
|
-
export declare const lowerCase: (str?: string) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Converts a string to camelCase.
|
|
19
|
-
*
|
|
20
|
-
* @example toCamelCase('hello-world') => 'helloWorld'
|
|
21
|
-
* @example toCamelCase('hello_world') => 'helloWorld'
|
|
22
|
-
*/
|
|
23
|
-
export declare const toCamelCase: (str: string) => string;
|
|
24
|
-
export declare const camelCase: (str: string) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Converts a string to kebab-case.
|
|
27
|
-
*
|
|
28
|
-
* @example toKebabCase('helloWorld') => 'hello-world'
|
|
29
|
-
* @example toKebabCase('Hello_World') => 'hello-world'
|
|
30
|
-
*/
|
|
31
|
-
export declare const toKebabCase: (str: string) => string;
|
|
32
|
-
export declare const kebabCase: (str: string) => string;
|
|
33
|
-
/**
|
|
34
|
-
* Converts a string to snake_case.
|
|
35
|
-
*
|
|
36
|
-
* @example toSnakeCase('helloWorld') => 'hello_world'
|
|
37
|
-
* @example toSnakeCase('hello-world') => 'hello_world'
|
|
38
|
-
*/
|
|
39
|
-
export declare const toSnakeCase: (str: string) => string;
|
|
40
|
-
export declare const snakeCase: (str: string) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Converts a string to PascalCase.
|
|
43
|
-
*
|
|
44
|
-
* @example toPascalCase('hello-world') => 'HelloWorld'
|
|
45
|
-
* @example toPascalCase('hello_world') => 'HelloWorld'
|
|
46
|
-
*/
|
|
47
|
-
export declare const toPascalCase: (str: string) => string;
|
|
48
|
-
export declare const pascalCase: (str: string) => string;
|
|
49
|
-
export declare const snakeCaseToSpaces: (str: string) => string;
|
|
50
|
-
export declare const kebabToSpaces: (str: string) => string;
|
|
51
|
-
/**
|
|
52
|
-
* Capitalizes the first character of a string.
|
|
53
|
-
*
|
|
54
|
-
* @example capitalize('hello world') => 'Hello world'
|
|
55
|
-
*/
|
|
56
|
-
export declare const capitalize: (str: string) => string;
|
|
57
|
-
/**
|
|
58
|
-
* Capitalizes the first letter of each word.
|
|
59
|
-
*
|
|
60
|
-
* @example titleCase('hello world') => 'Hello World'
|
|
61
|
-
*/
|
|
62
|
-
export declare const titleCase: (str: string) => string;
|
|
63
|
-
/**
|
|
64
|
-
* Truncates a string to a specified length and adds ellipsis.
|
|
65
|
-
*
|
|
66
|
-
* @example truncate('hello world', 5) => 'he...'
|
|
67
|
-
*/
|
|
68
|
-
export declare const truncate: (str: string, length: number, suffix?: string) => string;
|
|
69
|
-
/**
|
|
70
|
-
* Removes all whitespace from a string.
|
|
71
|
-
*
|
|
72
|
-
* @example removeWhitespace('hello world') => 'helloworld'
|
|
73
|
-
*/
|
|
74
|
-
export declare const removeWhitespace: (str: string) => string;
|
|
75
|
-
/**
|
|
76
|
-
* Removes all non-alphanumeric characters.
|
|
77
|
-
*
|
|
78
|
-
* @example removeSpecialChars('hello@world#123') => 'helloworld123'
|
|
79
|
-
*/
|
|
80
|
-
export declare const removeSpecialChars: (str: string) => string;
|
|
81
|
-
/**
|
|
82
|
-
* Generates a URL-friendly slug from a string.
|
|
83
|
-
*
|
|
84
|
-
* @example slug('Hello World 2024!') => 'hello-world-2024'
|
|
85
|
-
*/
|
|
86
|
-
export declare const slug: (str: string) => string;
|
|
87
|
-
/**
|
|
88
|
-
* Validates if a string is a valid email.
|
|
89
|
-
*
|
|
90
|
-
* @example isEmail('user@example.com') => true
|
|
91
|
-
*/
|
|
92
|
-
export declare const isEmail: (str: string) => boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Validates if a string is a valid URL.
|
|
95
|
-
*
|
|
96
|
-
* @example isUrl('https://example.com') => true
|
|
97
|
-
*/
|
|
98
|
-
export declare const isUrl: (str: string) => boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Validates if a string contains only numbers.
|
|
101
|
-
*
|
|
102
|
-
* @example isNumeric('12345') => true
|
|
103
|
-
* @example isNumeric('123abc') => false
|
|
104
|
-
*/
|
|
105
|
-
export declare const isNumeric: (str: string) => boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Checks if a string is empty or contains only whitespace.
|
|
108
|
-
*
|
|
109
|
-
* @example isEmpty(' ') => true
|
|
110
|
-
* @example isEmpty('hello') => false
|
|
111
|
-
*/
|
|
112
|
-
export declare const isEmpty: (str: string) => boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Reverses a string.
|
|
115
|
-
*
|
|
116
|
-
* @example reverse('hello') => 'olleh'
|
|
117
|
-
*/
|
|
118
|
-
export declare const reverse: (str: string) => string;
|
|
119
|
-
/**
|
|
120
|
-
* Repeats a string a specified number of times.
|
|
121
|
-
*
|
|
122
|
-
* @example repeat('ab', 3) => 'ababab'
|
|
123
|
-
*/
|
|
124
|
-
export declare const repeat: (str: string, times: number) => string;
|
|
125
|
-
/**
|
|
126
|
-
* Pads a string to a specified length.
|
|
127
|
-
*
|
|
128
|
-
* @example padStart('5', 3, '0') => '005'
|
|
129
|
-
* @example padEnd('5', 3, '0') => '500'
|
|
130
|
-
*/
|
|
131
|
-
export declare const padStart: (str: string, length: number, padChar?: string) => string;
|
|
132
|
-
export declare const padEnd: (str: string, length: number, padChar?: string) => string;
|
|
133
|
-
/**
|
|
134
|
-
* Encodes a string to Base64.
|
|
135
|
-
*
|
|
136
|
-
* @example toBase64('hello') => 'aGVsbG8='
|
|
137
|
-
*/
|
|
138
|
-
export declare const toBase64: (str: string) => string;
|
|
139
|
-
/**
|
|
140
|
-
* Decodes a Base64 string.
|
|
141
|
-
*
|
|
142
|
-
* @example fromBase64('aGVsbG8=') => 'hello'
|
|
143
|
-
*/
|
|
144
|
-
export declare const fromBase64: (str: string) => string;
|
|
145
|
-
/**
|
|
146
|
-
* Counts the number of words in a string.
|
|
147
|
-
*
|
|
148
|
-
* @example wordCount('hello world test') => 3
|
|
149
|
-
*/
|
|
150
|
-
export declare const wordCount: (str: string) => number;
|
|
151
|
-
/**
|
|
152
|
-
* Counts the number of characters, excluding whitespace.
|
|
153
|
-
*
|
|
154
|
-
* @example charCount('hello world') => 10
|
|
155
|
-
*/
|
|
156
|
-
export declare const charCount: (str: string) => number;
|
|
157
|
-
/**
|
|
158
|
-
* Repeats a character a specified number of times.
|
|
159
|
-
*
|
|
160
|
-
* @example repeatChar('*', 5) => '*****'
|
|
161
|
-
*/
|
|
162
|
-
export declare const repeatChar: (char: string, times: number) => string;
|
|
163
|
-
/**
|
|
164
|
-
* Extracts numbers from a string.
|
|
165
|
-
*
|
|
166
|
-
* @example extractNumbers('abc123def456') => '123456'
|
|
167
|
-
*/
|
|
168
|
-
export declare const extractNumbers: (str: string) => string;
|
|
169
|
-
/**
|
|
170
|
-
* Removes duplicate consecutive characters.
|
|
171
|
-
*
|
|
172
|
-
* @example removeDuplicates('aabbccdd') => 'abcd'
|
|
173
|
-
*/
|
|
174
|
-
export declare const removeDuplicates: (str: string) => string;
|
|
175
|
-
/**
|
|
176
|
-
* Checks if a string is a palindrome.
|
|
177
|
-
*
|
|
178
|
-
* @example isPalindrome('racecar') => true
|
|
179
|
-
* @example isPalindrome('hello') => false
|
|
180
|
-
*/
|
|
181
|
-
export declare const isPalindrome: (str: string) => boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Finds the longest word in a string.
|
|
184
|
-
*
|
|
185
|
-
* @example longestWord('the quick brown fox') => 'quick'
|
|
186
|
-
*/
|
|
187
|
-
export declare const longestWord: (str: string) => string;
|
|
188
|
-
/**
|
|
189
|
-
* Pluralizes common English words using a simple ruleset.
|
|
190
|
-
*
|
|
191
|
-
* @example pluralize('cat') => 'cats'
|
|
192
|
-
* @example pluralize('box') => 'boxes'
|
|
193
|
-
*/
|
|
194
|
-
export declare const pluralize: (word: string) => string;
|
|
195
|
-
/**
|
|
196
|
-
* Highlights a substring within a string by wrapping it with markers.
|
|
197
|
-
*
|
|
198
|
-
* @example highlight('hello world', 'world', '**') => 'hello **world**'
|
|
199
|
-
*/
|
|
200
|
-
export declare const highlight: (str: string, substring: string, marker?: string) => string;
|
|
201
|
-
/**
|
|
202
|
-
* Converts a string to a regex-safe string.
|
|
203
|
-
*
|
|
204
|
-
* @example escapeRegex('a.b*c') => 'a\\.b\\*c'
|
|
205
|
-
*/
|
|
206
|
-
export declare const escapeRegex: (str: string) => string;
|
|
207
|
-
/**
|
|
208
|
-
* Finds similarity between two strings using Levenshtein distance.
|
|
209
|
-
* Returns a value between 0 and 1, where 1 means identical.
|
|
210
|
-
*
|
|
211
|
-
* @example stringSimilarity('hello', 'hallo') => 0.8
|
|
212
|
-
*/
|
|
213
|
-
export declare const stringSimilarity: (str1: string, str2: string) => number;
|
|
214
|
-
/**
|
|
215
|
-
* Strips HTML tags from a string.
|
|
216
|
-
*
|
|
217
|
-
* @example stripHtml('<p>Hello <b>world</b></p>') => 'Hello world'
|
|
218
|
-
*/
|
|
219
|
-
export declare const stripHtml: (str: string) => string;
|
|
220
|
-
/**
|
|
221
|
-
* Replaces multiple spaces with a single space.
|
|
222
|
-
*
|
|
223
|
-
* @example normalizeSpaces('hello world') => 'hello world'
|
|
224
|
-
*/
|
|
225
|
-
export declare const normalizeSpaces: (str: string) => string;
|
|
226
|
-
/**
|
|
227
|
-
* Converts a string to a number, returning null if not valid.
|
|
228
|
-
*
|
|
229
|
-
* @example toNumber('123') => 123
|
|
230
|
-
* @example toNumber('abc') => null
|
|
231
|
-
*/
|
|
232
|
-
export declare const toNumber: (str: string) => number | null;
|
|
233
|
-
/**
|
|
234
|
-
* Splits a string by multiple delimiters.
|
|
235
|
-
*
|
|
236
|
-
* @example splitMultiple('a,b;c:d', ',', ';', ':') => ['a', 'b', 'c', 'd']
|
|
237
|
-
*/
|
|
238
|
-
export declare const splitMultiple: (str: string, ...delimiters: string[]) => string[];
|
|
239
|
-
/**
|
|
240
|
-
* Checks if a string contains any of the provided substrings.
|
|
241
|
-
*
|
|
242
|
-
* @example containsAny('hello world', 'foo', 'world') => true
|
|
243
|
-
*/
|
|
244
|
-
export declare const containsAny: (str: string, ...substrings: string[]) => boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Checks if a string contains all of the provided substrings.
|
|
247
|
-
*
|
|
248
|
-
* @example containsAll('hello world', 'hello', 'world') => true
|
|
249
|
-
*/
|
|
250
|
-
export declare const containsAll: (str: string, ...substrings: string[]) => boolean;
|
|
251
|
-
export interface IAddress {
|
|
252
|
-
addressLine1: string;
|
|
253
|
-
addressLine2?: string;
|
|
254
|
-
city: string;
|
|
255
|
-
stateCode: TUSStateCode;
|
|
256
|
-
postalCode: string;
|
|
257
|
-
}
|
|
258
|
-
export declare const formatAddress: (address: IAddress) => string;
|