@memberjunction/global 6.2.0-edge.0 → 6.2.0-edge.1
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/DeepDiff.d.ts +4 -0
- package/dist/DeepDiff.d.ts.map +1 -1
- package/dist/DeepDiff.js +10 -2
- package/dist/DeepDiff.js.map +1 -1
- package/dist/Global.js +2 -2
- package/dist/JSONValidator.d.ts +6 -0
- package/dist/JSONValidator.d.ts.map +1 -1
- package/dist/JSONValidator.js +18 -6
- package/dist/JSONValidator.js.map +1 -1
- package/dist/KeyedSerialTaskQueue.d.ts +8 -0
- package/dist/KeyedSerialTaskQueue.d.ts.map +1 -1
- package/dist/KeyedSerialTaskQueue.js +10 -2
- package/dist/KeyedSerialTaskQueue.js.map +1 -1
- package/dist/SQLExpressionValidator.d.ts +2 -0
- package/dist/SQLExpressionValidator.d.ts.map +1 -1
- package/dist/SQLExpressionValidator.js +5 -1
- package/dist/SQLExpressionValidator.js.map +1 -1
- package/dist/SafeExpressionEvaluator.d.ts +15 -0
- package/dist/SafeExpressionEvaluator.d.ts.map +1 -1
- package/dist/SafeExpressionEvaluator.js +19 -5
- package/dist/SafeExpressionEvaluator.js.map +1 -1
- package/dist/__tests__/OrdinalCompare.test.js +11 -11
- package/dist/__tests__/SafeExpressionEvaluator.test.js +3 -3
- package/dist/__tests__/detectRichTextFormat.test.js +25 -25
- package/dist/__tests__/util.test.js +76 -76
- package/dist/__tests__/valueMapping.test.js +21 -21
- package/dist/util/PatternUtils.d.ts +12 -0
- package/dist/util/PatternUtils.d.ts.map +1 -1
- package/dist/util/PatternUtils.js +32 -8
- package/dist/util/PatternUtils.js.map +1 -1
- package/dist/util.d.ts +31 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +70 -22
- package/dist/util.js.map +1 -1
- package/dist/valueMapping.d.ts +6 -0
- package/dist/valueMapping.d.ts.map +1 -1
- package/dist/valueMapping.js +19 -7
- package/dist/valueMapping.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
* parsePattern("*Run") // Returns: /Run$/i
|
|
25
25
|
* parsePattern("exact") // Returns: /^exact$/i
|
|
26
26
|
*/
|
|
27
|
+
export declare function ParsePattern(pattern: string): RegExp;
|
|
28
|
+
/** @deprecated Use {@link ParsePattern}. */
|
|
27
29
|
export declare function parsePattern(pattern: string): RegExp;
|
|
28
30
|
/**
|
|
29
31
|
* Converts an array of string patterns to RegExp objects
|
|
@@ -31,6 +33,8 @@ export declare function parsePattern(pattern: string): RegExp;
|
|
|
31
33
|
* @param patterns - Array of pattern strings
|
|
32
34
|
* @returns Array of RegExp objects
|
|
33
35
|
*/
|
|
36
|
+
export declare function ParsePatterns(patterns: string[]): RegExp[];
|
|
37
|
+
/** @deprecated Use {@link ParsePatterns}. */
|
|
34
38
|
export declare function parsePatterns(patterns: string[]): RegExp[];
|
|
35
39
|
/**
|
|
36
40
|
* Converts a pattern (string or RegExp) to a RegExp object
|
|
@@ -38,6 +42,8 @@ export declare function parsePatterns(patterns: string[]): RegExp[];
|
|
|
38
42
|
* @param pattern - String pattern or RegExp object
|
|
39
43
|
* @returns RegExp object
|
|
40
44
|
*/
|
|
45
|
+
export declare function EnsureRegExp(pattern: string | RegExp): RegExp;
|
|
46
|
+
/** @deprecated Use {@link EnsureRegExp}. */
|
|
41
47
|
export declare function ensureRegExp(pattern: string | RegExp): RegExp;
|
|
42
48
|
/**
|
|
43
49
|
* Converts an array of patterns (strings or RegExps) to RegExp objects
|
|
@@ -45,6 +51,8 @@ export declare function ensureRegExp(pattern: string | RegExp): RegExp;
|
|
|
45
51
|
* @param patterns - Array of string patterns or RegExp objects
|
|
46
52
|
* @returns Array of RegExp objects
|
|
47
53
|
*/
|
|
54
|
+
export declare function EnsureRegExps(patterns: (string | RegExp)[]): RegExp[];
|
|
55
|
+
/** @deprecated Use {@link EnsureRegExps}. */
|
|
48
56
|
export declare function ensureRegExps(patterns: (string | RegExp)[]): RegExp[];
|
|
49
57
|
/**
|
|
50
58
|
* Tests if a string matches any of the provided patterns
|
|
@@ -53,6 +61,8 @@ export declare function ensureRegExps(patterns: (string | RegExp)[]): RegExp[];
|
|
|
53
61
|
* @param patterns - Array of patterns (strings or RegExps)
|
|
54
62
|
* @returns true if any pattern matches
|
|
55
63
|
*/
|
|
64
|
+
export declare function MatchesAnyPattern(text: string, patterns: (string | RegExp)[]): boolean;
|
|
65
|
+
/** @deprecated Use {@link MatchesAnyPattern}. */
|
|
56
66
|
export declare function matchesAnyPattern(text: string, patterns: (string | RegExp)[]): boolean;
|
|
57
67
|
/**
|
|
58
68
|
* Tests if a string matches all of the provided patterns
|
|
@@ -61,5 +71,7 @@ export declare function matchesAnyPattern(text: string, patterns: (string | RegE
|
|
|
61
71
|
* @param patterns - Array of patterns (strings or RegExps)
|
|
62
72
|
* @returns true if all patterns match
|
|
63
73
|
*/
|
|
74
|
+
export declare function MatchesAllPatterns(text: string, patterns: (string | RegExp)[]): boolean;
|
|
75
|
+
/** @deprecated Use {@link MatchesAllPatterns}. */
|
|
64
76
|
export declare function matchesAllPatterns(text: string, patterns: (string | RegExp)[]): boolean;
|
|
65
77
|
//# sourceMappingURL=PatternUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PatternUtils.d.ts","sourceRoot":"","sources":["../../src/util/PatternUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsCpD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,CAAC,MA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iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAGtF;AAED,iDAAiD;AACjD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAEtF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAGvF;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAEvF"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* parsePattern("*Run") // Returns: /Run$/i
|
|
25
25
|
* parsePattern("exact") // Returns: /^exact$/i
|
|
26
26
|
*/
|
|
27
|
-
export function
|
|
27
|
+
export function ParsePattern(pattern) {
|
|
28
28
|
// Check if it's already a regex pattern (starts with /)
|
|
29
29
|
if (pattern.startsWith('/')) {
|
|
30
30
|
// Extract pattern and flags from regex string like "/pattern/flags"
|
|
@@ -57,14 +57,22 @@ export function parsePattern(pattern) {
|
|
|
57
57
|
// Simple patterns are case-insensitive by default
|
|
58
58
|
return new RegExp(regexPattern, 'i');
|
|
59
59
|
}
|
|
60
|
+
/** @deprecated Use {@link ParsePattern}. */
|
|
61
|
+
export function parsePattern(pattern) {
|
|
62
|
+
return ParsePattern(pattern);
|
|
63
|
+
}
|
|
60
64
|
/**
|
|
61
65
|
* Converts an array of string patterns to RegExp objects
|
|
62
66
|
*
|
|
63
67
|
* @param patterns - Array of pattern strings
|
|
64
68
|
* @returns Array of RegExp objects
|
|
65
69
|
*/
|
|
70
|
+
export function ParsePatterns(patterns) {
|
|
71
|
+
return patterns.map(ParsePattern);
|
|
72
|
+
}
|
|
73
|
+
/** @deprecated Use {@link ParsePatterns}. */
|
|
66
74
|
export function parsePatterns(patterns) {
|
|
67
|
-
return patterns
|
|
75
|
+
return ParsePatterns(patterns);
|
|
68
76
|
}
|
|
69
77
|
/**
|
|
70
78
|
* Converts a pattern (string or RegExp) to a RegExp object
|
|
@@ -72,8 +80,12 @@ export function parsePatterns(patterns) {
|
|
|
72
80
|
* @param pattern - String pattern or RegExp object
|
|
73
81
|
* @returns RegExp object
|
|
74
82
|
*/
|
|
83
|
+
export function EnsureRegExp(pattern) {
|
|
84
|
+
return pattern instanceof RegExp ? pattern : ParsePattern(pattern);
|
|
85
|
+
}
|
|
86
|
+
/** @deprecated Use {@link EnsureRegExp}. */
|
|
75
87
|
export function ensureRegExp(pattern) {
|
|
76
|
-
return
|
|
88
|
+
return EnsureRegExp(pattern);
|
|
77
89
|
}
|
|
78
90
|
/**
|
|
79
91
|
* Converts an array of patterns (strings or RegExps) to RegExp objects
|
|
@@ -81,8 +93,12 @@ export function ensureRegExp(pattern) {
|
|
|
81
93
|
* @param patterns - Array of string patterns or RegExp objects
|
|
82
94
|
* @returns Array of RegExp objects
|
|
83
95
|
*/
|
|
96
|
+
export function EnsureRegExps(patterns) {
|
|
97
|
+
return patterns.map(EnsureRegExp);
|
|
98
|
+
}
|
|
99
|
+
/** @deprecated Use {@link EnsureRegExps}. */
|
|
84
100
|
export function ensureRegExps(patterns) {
|
|
85
|
-
return patterns
|
|
101
|
+
return EnsureRegExps(patterns);
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
88
104
|
* Tests if a string matches any of the provided patterns
|
|
@@ -91,10 +107,14 @@ export function ensureRegExps(patterns) {
|
|
|
91
107
|
* @param patterns - Array of patterns (strings or RegExps)
|
|
92
108
|
* @returns true if any pattern matches
|
|
93
109
|
*/
|
|
94
|
-
export function
|
|
95
|
-
const regexps =
|
|
110
|
+
export function MatchesAnyPattern(text, patterns) {
|
|
111
|
+
const regexps = EnsureRegExps(patterns);
|
|
96
112
|
return regexps.some(pattern => pattern.test(text));
|
|
97
113
|
}
|
|
114
|
+
/** @deprecated Use {@link MatchesAnyPattern}. */
|
|
115
|
+
export function matchesAnyPattern(text, patterns) {
|
|
116
|
+
return MatchesAnyPattern(text, patterns);
|
|
117
|
+
}
|
|
98
118
|
/**
|
|
99
119
|
* Tests if a string matches all of the provided patterns
|
|
100
120
|
*
|
|
@@ -102,8 +122,12 @@ export function matchesAnyPattern(text, patterns) {
|
|
|
102
122
|
* @param patterns - Array of patterns (strings or RegExps)
|
|
103
123
|
* @returns true if all patterns match
|
|
104
124
|
*/
|
|
105
|
-
export function
|
|
106
|
-
const regexps =
|
|
125
|
+
export function MatchesAllPatterns(text, patterns) {
|
|
126
|
+
const regexps = EnsureRegExps(patterns);
|
|
107
127
|
return regexps.every(pattern => pattern.test(text));
|
|
108
128
|
}
|
|
129
|
+
/** @deprecated Use {@link MatchesAllPatterns}. */
|
|
130
|
+
export function matchesAllPatterns(text, patterns) {
|
|
131
|
+
return MatchesAllPatterns(text, patterns);
|
|
132
|
+
}
|
|
109
133
|
//# sourceMappingURL=PatternUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PatternUtils.js","sourceRoot":"","sources":["../../src/util/PatternUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,wDAAwD;IACxD,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,oEAAoE;QACpE,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,C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C,CAAC;AAC5C,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -236,6 +236,8 @@ export interface EntityNamingOptions {
|
|
|
236
236
|
* @param s - The database identifier to convert
|
|
237
237
|
* @param options - Optional naming configuration. When omitted, ALL CAPS normalization and compound splitting are enabled by default.
|
|
238
238
|
*/
|
|
239
|
+
export declare function CreateDisplayName(s: string, options?: EntityNamingOptions): string;
|
|
240
|
+
/** @deprecated Use {@link CreateDisplayName}. */
|
|
239
241
|
export declare function createDisplayName(s: string, options?: EntityNamingOptions): string;
|
|
240
242
|
/**
|
|
241
243
|
* Converts a string that uses camel casing or contains consecutive uppercase letters to have spaces between words.
|
|
@@ -243,6 +245,8 @@ export declare function createDisplayName(s: string, options?: EntityNamingOptio
|
|
|
243
245
|
* "DatabaseVersion" -> "Database Version"
|
|
244
246
|
* "AIAgentLearningCycle" -> "AI Agent Learning Cycle"
|
|
245
247
|
*/
|
|
248
|
+
export declare function ConvertCamelCaseToHaveSpaces(s: string): string;
|
|
249
|
+
/** @deprecated Use {@link ConvertCamelCaseToHaveSpaces}. */
|
|
246
250
|
export declare function convertCamelCaseToHaveSpaces(s: string): string;
|
|
247
251
|
/**
|
|
248
252
|
* Removes all whitespace characters (spaces, tabs, newlines) from a given string.
|
|
@@ -257,6 +261,8 @@ export declare function convertCamelCaseToHaveSpaces(s: string): string;
|
|
|
257
261
|
* stripWhitespace(""); // ""
|
|
258
262
|
* ```
|
|
259
263
|
*/
|
|
264
|
+
export declare function StripWhitespace(s: string): string;
|
|
265
|
+
/** @deprecated Use {@link StripWhitespace}. */
|
|
260
266
|
export declare function stripWhitespace(s: string): string;
|
|
261
267
|
/**
|
|
262
268
|
* Retrieves the plural form of a word if it is an irregular plural.
|
|
@@ -270,6 +276,8 @@ export declare function stripWhitespace(s: string): string;
|
|
|
270
276
|
* getIrregularPlural('dog'); // returns null
|
|
271
277
|
* ```
|
|
272
278
|
*/
|
|
279
|
+
export declare function GetIrregularPlural(singularName: string): string | null;
|
|
280
|
+
/** @deprecated Use {@link GetIrregularPlural}. */
|
|
273
281
|
export declare function getIrregularPlural(singularName: string): string | null;
|
|
274
282
|
/**
|
|
275
283
|
* Converts a singular word to its plural form, handling common pluralization rules
|
|
@@ -286,6 +294,11 @@ export declare function getIrregularPlural(singularName: string): string | null;
|
|
|
286
294
|
* generatePluralName('dog'); // returns 'dogs'
|
|
287
295
|
* ```
|
|
288
296
|
*/
|
|
297
|
+
export declare function GeneratePluralName(singularName: string, options?: {
|
|
298
|
+
capitalizeFirstLetterOnly?: boolean;
|
|
299
|
+
capitalizeEntireWord?: boolean;
|
|
300
|
+
}): string;
|
|
301
|
+
/** @deprecated Use {@link GeneratePluralName}. */
|
|
289
302
|
export declare function generatePluralName(singularName: string, options?: {
|
|
290
303
|
capitalizeFirstLetterOnly?: boolean;
|
|
291
304
|
capitalizeEntireWord?: boolean;
|
|
@@ -298,6 +311,12 @@ export declare function generatePluralName(singularName: string, options?: {
|
|
|
298
311
|
* @param options
|
|
299
312
|
* @returns
|
|
300
313
|
*/
|
|
314
|
+
export declare function AdjustCasing(word: string, options?: {
|
|
315
|
+
capitalizeFirstLetterOnly?: boolean;
|
|
316
|
+
capitalizeEntireWord?: boolean;
|
|
317
|
+
forceRestOfWordLowerCase?: boolean;
|
|
318
|
+
}): string;
|
|
319
|
+
/** @deprecated Use {@link AdjustCasing}. */
|
|
301
320
|
export declare function adjustCasing(word: string, options?: {
|
|
302
321
|
capitalizeFirstLetterOnly?: boolean;
|
|
303
322
|
capitalizeEntireWord?: boolean;
|
|
@@ -319,6 +338,8 @@ export declare function adjustCasing(word: string, options?: {
|
|
|
319
338
|
* stripTrailingChars(".txt", ".txt", true); // ".txt" (exact match, not stripped)
|
|
320
339
|
* ```
|
|
321
340
|
*/
|
|
341
|
+
export declare function StripTrailingChars(s: string, charsToStrip: string, skipIfExactMatch: boolean): string;
|
|
342
|
+
/** @deprecated Use {@link StripTrailingChars}. */
|
|
322
343
|
export declare function stripTrailingChars(s: string, charsToStrip: string, skipIfExactMatch: boolean): string;
|
|
323
344
|
/**
|
|
324
345
|
* Recursively removes all spaces from a given string.
|
|
@@ -335,11 +356,15 @@ export declare function stripTrailingChars(s: string, charsToStrip: string, skip
|
|
|
335
356
|
* replaceAllSpaces(""); // ""
|
|
336
357
|
* ```
|
|
337
358
|
*/
|
|
359
|
+
export declare function ReplaceAllSpaces(s: string): string;
|
|
360
|
+
/** @deprecated Use {@link ReplaceAllSpaces}. */
|
|
338
361
|
export declare function replaceAllSpaces(s: string): string;
|
|
339
362
|
/**
|
|
340
363
|
* Generates a version 4 UUID (Universally Unique Identifier) using the uuid library.
|
|
341
364
|
* @returns the generated UUID as a string.
|
|
342
365
|
*/
|
|
366
|
+
export declare function Uuidv4(): string;
|
|
367
|
+
/** @deprecated Use {@link Uuidv4}. */
|
|
343
368
|
export declare function uuidv4(): string;
|
|
344
369
|
/**
|
|
345
370
|
* Compares two strings line by line and logs the differences to the console.
|
|
@@ -351,6 +376,8 @@ export declare function uuidv4(): string;
|
|
|
351
376
|
* @param str2
|
|
352
377
|
* @returns An array of strings representing the differences found between the two input strings. If array is empty, it means no differences were found.
|
|
353
378
|
*/
|
|
379
|
+
export declare function CompareStringsByLine(str1: string, str2: string, logToConsole?: boolean): string[];
|
|
380
|
+
/** @deprecated Use {@link CompareStringsByLine}. */
|
|
354
381
|
export declare function compareStringsByLine(str1: string, str2: string, logToConsole?: boolean): string[];
|
|
355
382
|
/**
|
|
356
383
|
* Options for the ParseJSONRecursive function
|
|
@@ -469,6 +496,8 @@ export declare const DEFAULT_RICH_TEXT_SCAN_LENGTH = 500;
|
|
|
469
496
|
* @param maxScanLength - Leading characters to inspect. Defaults to {@link DEFAULT_RICH_TEXT_SCAN_LENGTH} (500).
|
|
470
497
|
* @returns `'markdown'`, `'html'`, or `'plain'`.
|
|
471
498
|
*/
|
|
499
|
+
export declare function DetectRichTextFormat(value: string | null | undefined, maxScanLength?: number): RichTextFormat;
|
|
500
|
+
/** @deprecated Use {@link DetectRichTextFormat}. */
|
|
472
501
|
export declare function detectRichTextFormat(value: string | null | undefined, maxScanLength?: number): RichTextFormat;
|
|
473
502
|
/**
|
|
474
503
|
* Build an HTML-safe string with every case-insensitive occurrence of `query` inside
|
|
@@ -532,5 +561,7 @@ export declare function ToEpochMs(value: Date | string | number | null | undefin
|
|
|
532
561
|
* users expect locale collation there. `localeCompare` without a locale argument follows the
|
|
533
562
|
* process ICU default and is not reproducible across machines.
|
|
534
563
|
*/
|
|
564
|
+
export declare function OrdinalCompare(a: string | null | undefined, b: string | null | undefined): number;
|
|
565
|
+
/** @deprecated Use {@link OrdinalCompare}. */
|
|
535
566
|
export declare function ordinalCompare(a: string | null | undefined, b: string | null | undefined): number;
|
|
536
567
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAE9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AASD,wBAAgB,oBAAoB,IAAI,iBAAiB,GAAG,IAAI,CA6B/D;AAGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EACjD,KAAK,EAAE,CAAC,EACR,yBAAyB,GAAE,OAAe,EAC1C,QAAQ,GAAE,MAAW,GACtB,OAAO,CAAC,CAAC,CAAC,CAkHZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,GA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AAI,GAAG,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEjG"}
|
package/dist/util.js
CHANGED
|
@@ -658,7 +658,7 @@ export function ConvertMarkdownStringToHtmlList(htmlListType, text) {
|
|
|
658
658
|
* @param s - The database identifier to convert
|
|
659
659
|
* @param options - Optional naming configuration. When omitted, ALL CAPS normalization and compound splitting are enabled by default.
|
|
660
660
|
*/
|
|
661
|
-
export function
|
|
661
|
+
export function CreateDisplayName(s, options) {
|
|
662
662
|
const normalizeAllCaps = options?.normalizeAllCaps ?? true;
|
|
663
663
|
const splitCompoundWords = options?.splitCompoundWords ?? true;
|
|
664
664
|
if (s.includes('_')) {
|
|
@@ -677,7 +677,11 @@ export function createDisplayName(s, options) {
|
|
|
677
677
|
// Entire string is ALL CAPS with no delimiters
|
|
678
678
|
s = normalizeAllCapsWord(s, splitCompoundWords, options?.additionalDomainWords);
|
|
679
679
|
}
|
|
680
|
-
return
|
|
680
|
+
return ConvertCamelCaseToHaveSpaces(s);
|
|
681
|
+
}
|
|
682
|
+
/** @deprecated Use {@link CreateDisplayName}. */
|
|
683
|
+
export function createDisplayName(s, options) {
|
|
684
|
+
return CreateDisplayName(s, options);
|
|
681
685
|
}
|
|
682
686
|
/**
|
|
683
687
|
* Checks if a string is entirely uppercase letters (and digits).
|
|
@@ -973,7 +977,7 @@ const __builtInDictionaryWords = [
|
|
|
973
977
|
* "DatabaseVersion" -> "Database Version"
|
|
974
978
|
* "AIAgentLearningCycle" -> "AI Agent Learning Cycle"
|
|
975
979
|
*/
|
|
976
|
-
export function
|
|
980
|
+
export function ConvertCamelCaseToHaveSpaces(s) {
|
|
977
981
|
let result = '';
|
|
978
982
|
for (let i = 0; i < s.length; ++i) {
|
|
979
983
|
if (i > 0 && // Not the first character
|
|
@@ -987,6 +991,10 @@ export function convertCamelCaseToHaveSpaces(s) {
|
|
|
987
991
|
}
|
|
988
992
|
return result;
|
|
989
993
|
}
|
|
994
|
+
/** @deprecated Use {@link ConvertCamelCaseToHaveSpaces}. */
|
|
995
|
+
export function convertCamelCaseToHaveSpaces(s) {
|
|
996
|
+
return ConvertCamelCaseToHaveSpaces(s);
|
|
997
|
+
}
|
|
990
998
|
/**
|
|
991
999
|
* Removes all whitespace characters (spaces, tabs, newlines) from a given string.
|
|
992
1000
|
*
|
|
@@ -1000,13 +1008,17 @@ export function convertCamelCaseToHaveSpaces(s) {
|
|
|
1000
1008
|
* stripWhitespace(""); // ""
|
|
1001
1009
|
* ```
|
|
1002
1010
|
*/
|
|
1003
|
-
export function
|
|
1011
|
+
export function StripWhitespace(s) {
|
|
1004
1012
|
if (!s) {
|
|
1005
1013
|
// Return the original string if it is null, undefined, or empty
|
|
1006
1014
|
return s;
|
|
1007
1015
|
}
|
|
1008
1016
|
return s.replace(/\s+/g, ''); // Use \s+ for efficiency in case of consecutive whitespace
|
|
1009
1017
|
}
|
|
1018
|
+
/** @deprecated Use {@link StripWhitespace}. */
|
|
1019
|
+
export function stripWhitespace(s) {
|
|
1020
|
+
return StripWhitespace(s);
|
|
1021
|
+
}
|
|
1010
1022
|
const __irregularPlurals = {
|
|
1011
1023
|
child: 'children',
|
|
1012
1024
|
person: 'people',
|
|
@@ -1082,9 +1094,13 @@ const __irregularPlurals = {
|
|
|
1082
1094
|
* getIrregularPlural('dog'); // returns null
|
|
1083
1095
|
* ```
|
|
1084
1096
|
*/
|
|
1085
|
-
export function
|
|
1097
|
+
export function GetIrregularPlural(singularName) {
|
|
1086
1098
|
return __irregularPlurals[singularName.toLowerCase()] || null;
|
|
1087
1099
|
}
|
|
1100
|
+
/** @deprecated Use {@link GetIrregularPlural}. */
|
|
1101
|
+
export function getIrregularPlural(singularName) {
|
|
1102
|
+
return GetIrregularPlural(singularName);
|
|
1103
|
+
}
|
|
1088
1104
|
/**
|
|
1089
1105
|
* Attempts to return a singular form of a given word, assuming it is already plural by reversing common pluralization rules.
|
|
1090
1106
|
*
|
|
@@ -1128,43 +1144,47 @@ function getSingularForm(word) {
|
|
|
1128
1144
|
* generatePluralName('dog'); // returns 'dogs'
|
|
1129
1145
|
* ```
|
|
1130
1146
|
*/
|
|
1131
|
-
export function
|
|
1147
|
+
export function GeneratePluralName(singularName, options) {
|
|
1132
1148
|
// Check if it's already plural
|
|
1133
1149
|
const detectedSingular = getSingularForm(singularName);
|
|
1134
1150
|
if (!detectedSingular) {
|
|
1135
1151
|
// if we did NOT find a singular, assume it is already plural
|
|
1136
|
-
return
|
|
1152
|
+
return AdjustCasing(singularName, options);
|
|
1137
1153
|
}
|
|
1138
1154
|
else if (detectedSingular.trim().toLowerCase() !== singularName.trim().toLowerCase()) {
|
|
1139
1155
|
// here we did detect a singular form. Check to see if it is DIFFERENT from
|
|
1140
1156
|
// the provided value. Because we're supposed to be provided a singular to this
|
|
1141
1157
|
// function if we are given a plural - like Customers - we want to just throw it back
|
|
1142
1158
|
// but if we were passed a true singular, then we keep on going
|
|
1143
|
-
return
|
|
1159
|
+
return AdjustCasing(singularName, options);
|
|
1144
1160
|
}
|
|
1145
1161
|
// Check for irregular plurals
|
|
1146
|
-
const irregularPlural =
|
|
1162
|
+
const irregularPlural = GetIrregularPlural(singularName);
|
|
1147
1163
|
if (irregularPlural) {
|
|
1148
|
-
return
|
|
1164
|
+
return AdjustCasing(irregularPlural, options);
|
|
1149
1165
|
}
|
|
1150
1166
|
// Handle common pluralization rules
|
|
1151
1167
|
if (singularName.endsWith('y') && singularName.length > 1) {
|
|
1152
1168
|
const secondLastChar = singularName[singularName.length - 2].toLowerCase();
|
|
1153
1169
|
if ('aeiou'.includes(secondLastChar)) {
|
|
1154
1170
|
// Ends with a vowel + y, just add 's'
|
|
1155
|
-
return
|
|
1171
|
+
return AdjustCasing(singularName + 's', options);
|
|
1156
1172
|
}
|
|
1157
1173
|
else {
|
|
1158
1174
|
// Ends with a consonant + y, replace 'y' with 'ies'
|
|
1159
|
-
return
|
|
1175
|
+
return AdjustCasing(singularName.slice(0, -1) + 'ies', options);
|
|
1160
1176
|
}
|
|
1161
1177
|
}
|
|
1162
1178
|
if (/(s|ch|sh|x|z)$/.test(singularName)) {
|
|
1163
1179
|
// Ends with 's', 'ch', 'sh', 'x', or 'z', add 'es'
|
|
1164
|
-
return
|
|
1180
|
+
return AdjustCasing(singularName + 'es', options);
|
|
1165
1181
|
}
|
|
1166
1182
|
// Default case: Add 's' to the singular name
|
|
1167
|
-
return
|
|
1183
|
+
return AdjustCasing(singularName + 's', options);
|
|
1184
|
+
}
|
|
1185
|
+
/** @deprecated Use {@link GeneratePluralName}. */
|
|
1186
|
+
export function generatePluralName(singularName, options) {
|
|
1187
|
+
return GeneratePluralName(singularName, options);
|
|
1168
1188
|
}
|
|
1169
1189
|
/**
|
|
1170
1190
|
* Utility method that will adjust the casing of a word based on the options provided. The options object can have two properties:
|
|
@@ -1174,7 +1194,7 @@ export function generatePluralName(singularName, options) {
|
|
|
1174
1194
|
* @param options
|
|
1175
1195
|
* @returns
|
|
1176
1196
|
*/
|
|
1177
|
-
export function
|
|
1197
|
+
export function AdjustCasing(word, options) {
|
|
1178
1198
|
if (word && word.length > 0 && options) {
|
|
1179
1199
|
if (options.capitalizeEntireWord) {
|
|
1180
1200
|
return word.toUpperCase();
|
|
@@ -1198,6 +1218,10 @@ export function adjustCasing(word, options) {
|
|
|
1198
1218
|
return word; //return whatever it is, blank string, null, or undefined, but no changes
|
|
1199
1219
|
}
|
|
1200
1220
|
}
|
|
1221
|
+
/** @deprecated Use {@link AdjustCasing}. */
|
|
1222
|
+
export function adjustCasing(word, options) {
|
|
1223
|
+
return AdjustCasing(word, options);
|
|
1224
|
+
}
|
|
1201
1225
|
/**
|
|
1202
1226
|
* Removes trailing characters from a string if they match the specified substring.
|
|
1203
1227
|
*
|
|
@@ -1214,7 +1238,7 @@ export function adjustCasing(word, options) {
|
|
|
1214
1238
|
* stripTrailingChars(".txt", ".txt", true); // ".txt" (exact match, not stripped)
|
|
1215
1239
|
* ```
|
|
1216
1240
|
*/
|
|
1217
|
-
export function
|
|
1241
|
+
export function StripTrailingChars(s, charsToStrip, skipIfExactMatch) {
|
|
1218
1242
|
if (!s || !charsToStrip) {
|
|
1219
1243
|
// Return the original string if either input is empty
|
|
1220
1244
|
return s;
|
|
@@ -1226,6 +1250,10 @@ export function stripTrailingChars(s, charsToStrip, skipIfExactMatch) {
|
|
|
1226
1250
|
}
|
|
1227
1251
|
return s;
|
|
1228
1252
|
}
|
|
1253
|
+
/** @deprecated Use {@link StripTrailingChars}. */
|
|
1254
|
+
export function stripTrailingChars(s, charsToStrip, skipIfExactMatch) {
|
|
1255
|
+
return StripTrailingChars(s, charsToStrip, skipIfExactMatch);
|
|
1256
|
+
}
|
|
1229
1257
|
/**
|
|
1230
1258
|
* Recursively removes all spaces from a given string.
|
|
1231
1259
|
*
|
|
@@ -1241,25 +1269,33 @@ export function stripTrailingChars(s, charsToStrip, skipIfExactMatch) {
|
|
|
1241
1269
|
* replaceAllSpaces(""); // ""
|
|
1242
1270
|
* ```
|
|
1243
1271
|
*/
|
|
1244
|
-
export function
|
|
1272
|
+
export function ReplaceAllSpaces(s) {
|
|
1245
1273
|
if (!s) {
|
|
1246
1274
|
// Handle null, undefined, or empty string cases
|
|
1247
1275
|
return s;
|
|
1248
1276
|
}
|
|
1249
1277
|
if (s.includes(' ')) {
|
|
1250
1278
|
// Recursive case: Replace a single space and call the function again
|
|
1251
|
-
return
|
|
1279
|
+
return ReplaceAllSpaces(s.replace(' ', ''));
|
|
1252
1280
|
}
|
|
1253
1281
|
// Base case: No spaces left to replace
|
|
1254
1282
|
return s;
|
|
1255
1283
|
}
|
|
1284
|
+
/** @deprecated Use {@link ReplaceAllSpaces}. */
|
|
1285
|
+
export function replaceAllSpaces(s) {
|
|
1286
|
+
return ReplaceAllSpaces(s);
|
|
1287
|
+
}
|
|
1256
1288
|
/**
|
|
1257
1289
|
* Generates a version 4 UUID (Universally Unique Identifier) using the uuid library.
|
|
1258
1290
|
* @returns the generated UUID as a string.
|
|
1259
1291
|
*/
|
|
1260
|
-
export function
|
|
1292
|
+
export function Uuidv4() {
|
|
1261
1293
|
return v4();
|
|
1262
1294
|
}
|
|
1295
|
+
/** @deprecated Use {@link Uuidv4}. */
|
|
1296
|
+
export function uuidv4() {
|
|
1297
|
+
return Uuidv4();
|
|
1298
|
+
}
|
|
1263
1299
|
/**
|
|
1264
1300
|
* Compares two strings line by line and logs the differences to the console.
|
|
1265
1301
|
* This function is useful for debugging purposes to identify discrepancies between two text inputs.
|
|
@@ -1270,7 +1306,7 @@ export function uuidv4() {
|
|
|
1270
1306
|
* @param str2
|
|
1271
1307
|
* @returns An array of strings representing the differences found between the two input strings. If array is empty, it means no differences were found.
|
|
1272
1308
|
*/
|
|
1273
|
-
export function
|
|
1309
|
+
export function CompareStringsByLine(str1, str2, logToConsole = true) {
|
|
1274
1310
|
const lines1 = str1.split('\n');
|
|
1275
1311
|
const lines2 = str2.split('\n');
|
|
1276
1312
|
const maxLines = Math.max(lines1.length, lines2.length);
|
|
@@ -1310,6 +1346,10 @@ export function compareStringsByLine(str1, str2, logToConsole = true) {
|
|
|
1310
1346
|
}
|
|
1311
1347
|
return returnArray;
|
|
1312
1348
|
}
|
|
1349
|
+
/** @deprecated Use {@link CompareStringsByLine}. */
|
|
1350
|
+
export function compareStringsByLine(str1, str2, logToConsole = true) {
|
|
1351
|
+
return CompareStringsByLine(str1, str2, logToConsole);
|
|
1352
|
+
}
|
|
1313
1353
|
/**
|
|
1314
1354
|
* Recursively parse JSON strings within an object/array structure.
|
|
1315
1355
|
* This function will traverse through objects and arrays, attempting to parse
|
|
@@ -1507,7 +1547,7 @@ const WEAK_MARKDOWN_PATTERNS = [
|
|
|
1507
1547
|
* @param maxScanLength - Leading characters to inspect. Defaults to {@link DEFAULT_RICH_TEXT_SCAN_LENGTH} (500).
|
|
1508
1548
|
* @returns `'markdown'`, `'html'`, or `'plain'`.
|
|
1509
1549
|
*/
|
|
1510
|
-
export function
|
|
1550
|
+
export function DetectRichTextFormat(value, maxScanLength = DEFAULT_RICH_TEXT_SCAN_LENGTH) {
|
|
1511
1551
|
if (!value)
|
|
1512
1552
|
return 'plain';
|
|
1513
1553
|
const limit = maxScanLength > 0 ? maxScanLength : DEFAULT_RICH_TEXT_SCAN_LENGTH;
|
|
@@ -1522,6 +1562,10 @@ export function detectRichTextFormat(value, maxScanLength = DEFAULT_RICH_TEXT_SC
|
|
|
1522
1562
|
return 'html';
|
|
1523
1563
|
return 'plain';
|
|
1524
1564
|
}
|
|
1565
|
+
/** @deprecated Use {@link DetectRichTextFormat}. */
|
|
1566
|
+
export function detectRichTextFormat(value, maxScanLength = DEFAULT_RICH_TEXT_SCAN_LENGTH) {
|
|
1567
|
+
return DetectRichTextFormat(value, maxScanLength);
|
|
1568
|
+
}
|
|
1525
1569
|
/** True when the sample shows a strong Markdown signal, or two or more weak signals. */
|
|
1526
1570
|
function hasMarkdownSignals(sample) {
|
|
1527
1571
|
if (STRONG_MARKDOWN_PATTERNS.some((re) => re.test(sample)))
|
|
@@ -1725,9 +1769,13 @@ export function ToEpochMs(value) {
|
|
|
1725
1769
|
* users expect locale collation there. `localeCompare` without a locale argument follows the
|
|
1726
1770
|
* process ICU default and is not reproducible across machines.
|
|
1727
1771
|
*/
|
|
1728
|
-
export function
|
|
1772
|
+
export function OrdinalCompare(a, b) {
|
|
1729
1773
|
const sa = a ?? '';
|
|
1730
1774
|
const sb = b ?? '';
|
|
1731
1775
|
return sa < sb ? -1 : sa > sb ? 1 : 0;
|
|
1732
1776
|
}
|
|
1777
|
+
/** @deprecated Use {@link OrdinalCompare}. */
|
|
1778
|
+
export function ordinalCompare(a, b) {
|
|
1779
|
+
return OrdinalCompare(a, b);
|
|
1780
|
+
}
|
|
1733
1781
|
//# sourceMappingURL=util.js.map
|