expensify-common 2.0.209 → 2.0.211

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/str.d.ts CHANGED
@@ -5,6 +5,26 @@
5
5
  */
6
6
  declare function resultFn(parameter: string): string;
7
7
  declare function resultFn<R, A extends unknown[]>(parameter: (...args: A) => R, ...args: A): R;
8
+ declare function compare(strA: string, strB: string): 1 | 0 | -1;
9
+ declare function caseInsensitiveCompare(strA: string, strB: string): 1 | 0 | -1;
10
+ declare function contains(haystack: string, needle: string): boolean;
11
+ declare function cutAfter(str: string, substr: string): string;
12
+ declare function cutBefore(str: string, substr: string): string;
13
+ declare function extractEmailDomain(email: string): string;
14
+ declare function getExtension(url: string): string | undefined;
15
+ declare function getRawByteSize(inputChar: string): number;
16
+ declare function htmlDecode(s: string): string;
17
+ declare function htmlEncode(s: string): string;
18
+ declare function isTypeOf(obj: unknown, type: 'Arguments' | 'Function' | 'String' | 'Number' | 'Date' | 'RegExp' | 'Error' | 'Symbol' | 'Map' | 'WeakMap' | 'Set' | 'WeakSet'): boolean;
19
+ declare function isNumber(obj: unknown): obj is number;
20
+ declare function isString(obj: unknown): obj is string;
21
+ declare function isUndefined(obj: unknown): boolean;
22
+ declare function isValidE164Phone(phone: string): boolean;
23
+ declare function isValidEmail(str: string): boolean;
24
+ declare function maskFirstNCharacters(str: string, num: number, mask: string): string;
25
+ declare function removeSMSDomain(text: string): string;
26
+ declare function removeTrailingComma(str: string): string;
27
+ declare function startsWith(haystack: string, needle: string): boolean;
8
28
  declare const Str: {
9
29
  /**
10
30
  * Return true if the string is ending with the provided suffix
@@ -37,14 +57,14 @@ declare const Str: {
37
57
  * @param s The string to decode.
38
58
  * @returns The decoded string.
39
59
  */
40
- htmlDecode(s: string): string;
60
+ htmlDecode: typeof htmlDecode;
41
61
  /**
42
62
  * HTML encodes the given string.
43
63
  *
44
64
  * @param s The string to encode.
45
65
  * @return string @p s HTML encoded.
46
66
  */
47
- htmlEncode(s: string): string;
67
+ htmlEncode: typeof htmlEncode;
48
68
  /**
49
69
  * Decodes the given HTML encoded string.
50
70
  *
@@ -125,7 +145,7 @@ declare const Str: {
125
145
  * one.
126
146
  * @returns Byte size of the character
127
147
  */
128
- getRawByteSize(inputChar: string): number;
148
+ getRawByteSize: typeof getRawByteSize;
129
149
  /**
130
150
  * Gets the length of a string in bytes, including non-ASCII characters
131
151
  * @returns The number of bytes used by string
@@ -144,7 +164,7 @@ declare const Str: {
144
164
  * @param needle The case-sensitive string to search for
145
165
  * @returns True if the haystack starts with the needle.
146
166
  */
147
- startsWith(haystack: string, needle: string): boolean;
167
+ startsWith: typeof startsWith;
148
168
  /**
149
169
  * Gets the textual value of the given string.
150
170
  *
@@ -168,7 +188,7 @@ declare const Str: {
168
188
  * @param substr The substring to search for.
169
189
  * @returns The cut/trimmed string.
170
190
  */
171
- cutAfter(str: string, substr: string): string;
191
+ cutAfter: typeof cutAfter;
172
192
  /**
173
193
  * Returns a string containing all the characters str from after the first
174
194
  * occurrence of substr to the end of the string.
@@ -178,7 +198,7 @@ declare const Str: {
178
198
  * @param substr The substring to search for.
179
199
  * @returns The cut/trimmed string.
180
200
  */
181
- cutBefore(str: string, substr: string): string;
201
+ cutBefore: typeof cutBefore;
182
202
  /**
183
203
  * Checks that the string is a domain name (e.g. example.com)
184
204
  *
@@ -201,7 +221,7 @@ declare const Str: {
201
221
  *
202
222
  * @returns True if the string is an email
203
223
  */
204
- isValidEmail(str: string): boolean;
224
+ isValidEmail: typeof isValidEmail;
205
225
  /**
206
226
  * Checks if the string is an valid email address formed during comment markdown formation.
207
227
  *
@@ -217,7 +237,7 @@ declare const Str: {
217
237
  *
218
238
  * @returns string with the trailing comma removed
219
239
  */
220
- removeTrailingComma(str: string): string;
240
+ removeTrailingComma: typeof removeTrailingComma;
221
241
  /**
222
242
  * Checks that the string is a list of coma separated email addresss.
223
243
  *
@@ -238,7 +258,7 @@ declare const Str: {
238
258
  *
239
259
  * @returns The domain name in the email address.
240
260
  */
241
- extractEmailDomain(email: string): string;
261
+ extractEmailDomain: typeof extractEmailDomain;
242
262
  /**
243
263
  * Tries to extract the company name from the given email address
244
264
  * (e.g. "yelp" for "joe@yelp.co.uk").
@@ -327,7 +347,7 @@ declare const Str: {
327
347
  *
328
348
  * @returns Returns true if the haystack contains the needle
329
349
  */
330
- contains(haystack: string, needle: string): boolean;
350
+ contains: typeof contains;
331
351
  /**
332
352
  * Returns true if the haystack contains the needle, ignoring case
333
353
  *
@@ -347,7 +367,7 @@ declare const Str: {
347
367
  * 1 if first string > second string
348
368
  * 0 if first string = second string
349
369
  */
350
- caseInsensitiveCompare(strA: string, strB: string): 1 | 0 | -1;
370
+ caseInsensitiveCompare: typeof caseInsensitiveCompare;
351
371
  /**
352
372
  * Case insensitive equals
353
373
  *
@@ -366,7 +386,7 @@ declare const Str: {
366
386
  * 1 if first string > second string
367
387
  * 0 if first string = second string
368
388
  */
369
- compare(strA: string, strB: string): 1 | 0 | -1;
389
+ compare: typeof compare;
370
390
  /**
371
391
  * Check if a file extension is supported by SmartReports
372
392
  */
@@ -381,23 +401,23 @@ declare const Str: {
381
401
  * Checks if something is a string
382
402
  * Stolen from underscore
383
403
  */
384
- isString(obj: unknown): obj is string;
404
+ isString: typeof isString;
385
405
  /**
386
406
  * Checks if something is a number
387
407
  * Stolen from underscore
388
408
  * @param obj
389
409
  */
390
- isNumber(obj: unknown): obj is number;
410
+ isNumber: typeof isNumber;
391
411
  /**
392
412
  * Checks if something is a certain type
393
413
  * Stolen from underscore
394
414
  */
395
- isTypeOf(obj: unknown, type: "Arguments" | "Function" | "String" | "Number" | "Date" | "RegExp" | "Error" | "Symbol" | "Map" | "WeakMap" | "Set" | "WeakSet"): boolean;
415
+ isTypeOf: typeof isTypeOf;
396
416
  /**
397
417
  * Checks to see if something is undefined
398
418
  * Stolen from underscore
399
419
  */
400
- isUndefined(obj: unknown): boolean;
420
+ isUndefined: typeof isUndefined;
401
421
  /**
402
422
  * Replace first N characters of the string with maskChar
403
423
  * eg: maskFirstNCharacters( '1234567890', 6, 'X' ) yields XXXXXX7890
@@ -406,7 +426,7 @@ declare const Str: {
406
426
  * @param mask String we want replace the first N chars with
407
427
  * @returns Masked string
408
428
  */
409
- maskFirstNCharacters(str: string, num: number, mask: string): string;
429
+ maskFirstNCharacters: typeof maskFirstNCharacters;
410
430
  /**
411
431
  * Trim a string
412
432
  */
@@ -468,7 +488,7 @@ declare const Str: {
468
488
  /**
469
489
  * Check for whether a phone number is valid according to E.164 standard.
470
490
  */
471
- isValidE164Phone(phone: string): boolean;
491
+ isValidE164Phone: typeof isValidE164Phone;
472
492
  /**
473
493
  * Check for whether a phone number is valid in different formats/standards. For example:
474
494
  * significant: 4404589784
@@ -485,7 +505,7 @@ declare const Str: {
485
505
  /**
486
506
  * Returns text without our SMS domain
487
507
  */
488
- removeSMSDomain(text: string): string;
508
+ removeSMSDomain: typeof removeSMSDomain;
489
509
  /**
490
510
  * Returns true if the text is a valid E.164 phone number with our SMS domain removed
491
511
  */
@@ -531,7 +551,7 @@ declare const Str: {
531
551
  * Get file extension for a given url with or
532
552
  * without query parameters
533
553
  */
534
- getExtension(url: string): string | undefined;
554
+ getExtension: typeof getExtension;
535
555
  /**
536
556
  * Takes in a URL and checks if the file extension is PDF
537
557
  *