@cellaware/utils 8.9.0 → 8.10.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.
@@ -12,12 +12,14 @@ export declare const ALERT_VISIBILITY_PUBLIC = "public";
12
12
  * good sometimes, but could be very annoying otherwise. The strategy allows users to
13
13
  * configure this behavior.
14
14
  *
15
+ * - temporary: will send once when the condition is met and will automatically be deleted
15
16
  * - once: will send once when the condition is met and will not send again until the condition
16
17
  * is no longer met
17
18
  * - change: if the condition is met, will send if there was a meaningful change in the data
18
19
  * since last execution
19
20
  * - always: sends every time as long as the condition is met
20
21
  */
22
+ export declare const ALERT_STRATEGY_TEMPORARY = "temporary";
21
23
  export declare const ALERT_STRATEGY_ONCE = "once";
22
24
  export declare const ALERT_STRATEGY_CHANGE = "change";
23
25
  export declare const ALERT_STRATEGY_ALWAYS = "always";
@@ -11,12 +11,14 @@ export const ALERT_VISIBILITY_PUBLIC = 'public';
11
11
  * good sometimes, but could be very annoying otherwise. The strategy allows users to
12
12
  * configure this behavior.
13
13
  *
14
+ * - temporary: will send once when the condition is met and will automatically be deleted
14
15
  * - once: will send once when the condition is met and will not send again until the condition
15
16
  * is no longer met
16
17
  * - change: if the condition is met, will send if there was a meaningful change in the data
17
18
  * since last execution
18
19
  * - always: sends every time as long as the condition is met
19
20
  */
21
+ export const ALERT_STRATEGY_TEMPORARY = 'temporary';
20
22
  export const ALERT_STRATEGY_ONCE = 'once';
21
23
  export const ALERT_STRATEGY_CHANGE = 'change';
22
24
  export const ALERT_STRATEGY_ALWAYS = 'always';
package/dist/util.d.ts CHANGED
@@ -40,6 +40,6 @@ export interface QueryRegexMatch {
40
40
  */
41
41
  export declare function getQueryMatches(query: string, regex: RegExp): QueryRegexMatch[];
42
42
  export declare function removeQueryMatches(query: string, matches: QueryRegexMatch[]): string;
43
- export declare function replaceQueryMatches(query: string, matches: QueryRegexMatch[], replacement: string): string;
43
+ export declare function replaceQueryMatches(query: string, matches: QueryRegexMatch[], replacement: string, useMatchAsSuffix?: boolean): string;
44
44
  export declare function removeMarkdownIndicators(input: string): string;
45
45
  export declare function removePrefixIndicators(input: string, prefixes: string[]): string;
package/dist/util.js CHANGED
@@ -246,17 +246,21 @@ export function removeQueryMatches(query, matches) {
246
246
  }
247
247
  return adjQuery;
248
248
  }
249
- export function replaceQueryMatches(query, matches, replacement) {
249
+ export function replaceQueryMatches(query, matches, replacement, useMatchAsSuffix) {
250
250
  let adjQuery = query;
251
251
  let offset = 0;
252
252
  for (const match of matches) {
253
253
  const start = match.startIdx - offset;
254
254
  const stop = match.stopIdx + 1 - offset;
255
+ let adjReplacement = replacement;
256
+ if (!!useMatchAsSuffix) {
257
+ adjReplacement = replacement + '_' + match.word;
258
+ }
255
259
  adjQuery =
256
260
  adjQuery.substring(0, start) +
257
- replacement +
261
+ adjReplacement +
258
262
  adjQuery.substring(stop);
259
- offset += (match.word.length - replacement.length);
263
+ offset += (match.word.length - adjReplacement.length);
260
264
  }
261
265
  return adjQuery;
262
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.9.0",
3
+ "version": "8.10.1",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",