• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jumpinjackie / mapguide-react-layout / 15160422871

21 May 2025 11:00AM UTC coverage: 21.479% (-42.8%) from 64.24%
15160422871

Pull #1552

github

web-flow
Merge 3916e4b02 into 236e2ea07
Pull Request #1552: Feature/package updates 2505

840 of 1168 branches covered (71.92%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22319 relevant lines covered (21.48%)

6.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.19
/src/utils/string.ts
1
/**
2
 * Indicates if the given string ends with the given suffix
3
 *
4
 * @export
5
 * @param {string} str
6
 * @param {string} suffix
7
 * @returns {boolean}
8
 */
9
export function strEndsWith(str: string, suffix: string): boolean {
1✔
10
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
10✔
11
}
10✔
12

13
/**
14
 * Indicates if the given string starts with the given string
15
 * 
16
 * @param {string} str 
17
 * @param {string} word 
18
 * @returns {boolean}
19
 * @since 0.14
20
 */
21
export function strStartsWith(str: string, word: string) {
1✔
22
    return str.lastIndexOf(word, 0) === 0;
211✔
23
}
211✔
24

25
/**
26
 * Replaces all occurrences of the given string with the specified replacement in the target
27
 * string
28
 * 
29
 * @param str 
30
 * @param find 
31
 * @param replace 
32
 * @since 0.12
33
 */
34
export function strReplaceAll(str: string, find: string, replace: string): string {
1✔
35
    return str.split(find).join(replace);
2✔
36
}
2✔
37

38
/**
39
 * Empty string constant
40
 */
41
export const STR_EMPTY = "";
1✔
42

43
/**
44
 * Indicates if the given string is null or empty
45
 *
46
 * @export
47
 * @param {(string | null | undefined)} str
48
 * @returns {boolean}
49
 */
50
export function strIsNullOrEmpty(str: string | null | undefined): str is null | undefined {
1✔
51
    return null == str || "" === str;
129✔
52
}
129✔
53

54
/**
55
 * Returns a trimmed version of the given string
56
 * 
57
 * @param str The string to trim
58
 * @since 0.12.5
59
 */
60
export function strTrim(str: string): string {
1✔
61
    if (!String.prototype.trim) {
9!
62
        return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
×
UNCOV
63
    }
×
64
    return str.trim();
9✔
65
}
9✔
66

67
/**
68
 *
69
 *
70
 * @export
71
 * @param {string} expr
72
 * @param {string} delimBegin
73
 * @param {string} delimEnd
74
 * @returns
75
 * @since 0.14
76
 */
77
export function extractPlaceholderTokens(expr: string, delimBegin: string, delimEnd: string) {
1✔
78
    const regex = new RegExp(`${delimBegin}(.*?)${delimEnd}`, "g");
1✔
79
    const matches = expr.match(regex);
1✔
80
    return matches?.map(m => m.replace(delimBegin, "").replace(delimEnd, "")) ?? [];
1!
81
}
1✔
82

83
/**
84
 * Gets whether the given string is a resource identifier
85
 * 
86
 * @param str The string to test
87
 * @since 0.14
88
 */
89
export function isResourceId(str: string): boolean {
1✔
90
    return strStartsWith(str, "Library://")
×
UNCOV
91
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc