Skip to content

Commit

Permalink
fix: use global if window is not available (2 of 2)
Browse files Browse the repository at this point in the history
Completes a partial fix that was started in bab4242
  • Loading branch information
olsen232 committed Jan 13, 2025
1 parent 449ac26 commit db62cd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CqlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export class CqlParser {

read(text: string | undefined): Filter | Expression<PropertyType> | undefined {
try {
// @ts-expect-error defined in the window object
return window.cqlParser.parse(text);
// @ts-expect-error cqlParser is defined in the window / global object - see cql-parser.cjs
return (typeof window !== 'undefined' ? window : global).cqlParser.parse(text);
} catch (e) {
return undefined;
}
Expand Down

0 comments on commit db62cd6

Please sign in to comment.