@malloydata/malloy 0.0.260 → 0.0.261-dev250410215229

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.
@@ -79,12 +79,16 @@ const checkCustomErrorMessage = (parser, offendingSymbol, errorCases) => {
79
79
  let message = errReplace(errorCase.errorMessage);
80
80
  if (errorCase.alternatives) {
81
81
  const badWord = errReplace(errorCase.alternatives.replace);
82
- const distances = {};
83
- for (const w of errorCase.alternatives.with) {
84
- distances[w] = (0, jaro_winkler_1.default)(w, badWord);
82
+ let closest = errorCase.alternatives.with[0];
83
+ let close = (0, jaro_winkler_1.default)(closest, badWord);
84
+ for (const w of errorCase.alternatives.with.slice(1)) {
85
+ const howClose = (0, jaro_winkler_1.default)(w, badWord);
86
+ if (howClose > close) {
87
+ close = howClose;
88
+ closest = w;
89
+ }
85
90
  }
86
- const picks = errorCase.alternatives.with.sort((a, b) => distances[b] - distances[a]);
87
- message += ` Did you mean '${picks[0]}'?`;
91
+ message += ` Did you mean '${closest}'?`;
88
92
  }
89
93
  return message;
90
94
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.260";
1
+ export declare const MALLOY_VERSION = "0.0.261";
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MALLOY_VERSION = void 0;
4
4
  // generated with 'generate-version-file' script; do not edit manually
5
- exports.MALLOY_VERSION = '0.0.260';
5
+ exports.MALLOY_VERSION = '0.0.261';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.260",
3
+ "version": "0.0.261-dev250410215229",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -41,21 +41,21 @@
41
41
  "generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@malloydata/malloy-filter": "^0.0.260",
45
- "@malloydata/malloy-interfaces": "^0.0.260",
46
- "@malloydata/malloy-tag": "^0.0.260",
44
+ "@malloydata/malloy-filter": "^0.0.261-dev250410215229",
45
+ "@malloydata/malloy-interfaces": "^0.0.261-dev250410215229",
46
+ "@malloydata/malloy-tag": "^0.0.261-dev250410215229",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
+ "jaro-winkler": "^0.2.8",
49
50
  "jest-diff": "^29.6.2",
50
51
  "lodash": "^4.17.20",
51
52
  "luxon": "^2.4.0",
52
- "jaro-winkler": "^0.2.8",
53
53
  "uuid": "^8.3.2"
54
54
  },
55
55
  "devDependencies": {
56
+ "@types/jaro-winkler": "^0.2.3",
56
57
  "@types/lodash": "^4.14.165",
57
58
  "@types/luxon": "^2.4.0",
58
- "@types/jaro-winkler": "^0.2.3",
59
59
  "antlr4ts-cli": "^0.5.0-alpha.4"
60
60
  }
61
61
  }