Skip to content

Commit

Permalink
v0fix: fixed valueComparer option in example shortcutContextParser
Browse files Browse the repository at this point in the history
removed non-working advancedValueComparer
  • Loading branch information
AlansCodeLog committed May 19, 2024
1 parent 8535b2c commit 873ba57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
31 changes: 0 additions & 31 deletions src/examples/advancedValueComparer.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/examples/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* Autogenerated Index */

export { ShortcutContextParser } from "./shortcutContextParser.js"
export { valueComparer } from "./advancedValueComparer.js"
8 changes: 4 additions & 4 deletions src/examples/shortcutContextParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class ShortcutContextParser<T extends
}
return prefix + variable
},
valueComparer: (_condition, contextValue, query) => {
if (query.isRegex) {
return contextValue.match(new RegExp(query.value as string, query.regexFlags ?? "")) !== null
valueComparer: (condition, contextValue, _context) => {
if (condition.value instanceof RegExp) {
return contextValue.match(condition.value) !== null
}
return contextValue === query.value
return contextValue === condition.value
},
valueValidator: (_contextValue, query): T[] | void => {
let tokens: T[] = []
Expand Down

0 comments on commit 873ba57

Please sign in to comment.