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

jumpinjackie / mapguide-react-layout / 15165370206

21 May 2025 02:48PM UTC coverage: 22.447%. Remained the same
15165370206

push

github

jumpinjackie
#1555: More internalization of things that shouldn't be in the API documentation.

Also dd merge-modules plugin for typedoc which flattens our public symbol list, which makes better sense as our node module usage story is to import from a flat barrel "mapguide-react-layout" module.

878 of 1206 branches covered (72.8%)

4975 of 22163 relevant lines covered (22.45%)

6.95 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
 * @param {string} str
5
 * @param {string} suffix
6
 * @returns {boolean}
7
 */
8
export function strEndsWith(str: string, suffix: string): boolean {
1✔
9
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
10✔
10
}
10✔
11

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

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

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

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

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

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

80
/**
81
 * Gets whether the given string is a resource identifier
82
 * 
83
 * @param str The string to test
84
 * @since 0.14
85
 */
86
export function isResourceId(str: string): boolean {
1✔
87
    return strStartsWith(str, "Library://")
×
88
}
×
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