Skip to content

Commit

Permalink
chore(export-to-language): replace usage of vm module COMPASS-7312 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax authored Oct 10, 2023
1 parent 2d07d1d commit 66099ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/compass-export-to-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"chai": "^4.3.6",
"compass-preferences-model": "^2.15.1",
"depcheck": "^1.4.1",
"ejson-shell-parser": "^1.2.4",
"enzyme": "^3.11.0",
"eslint": "^7.25.0",
"hadron-app-registry": "^9.0.11",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import parseShellBSON, { ParseMode } from 'ejson-shell-parser';

export function countAggregationStagesInString(source: string): number {
const parsed = parseShellBSON(source, { mode: ParseMode.Loose });
if (!Array.isArray(parsed)) {
throw new Error('Source expression is not an aggregation stage array');
}
return parsed.length;
}

0 comments on commit 66099ac

Please sign in to comment.