@asyncapi/generator
Advanced tools
Comparing version 0.51.0 to 0.51.1
@@ -68,5 +68,13 @@ const semver = require('semver'); | ||
function provideAdvice(wrongParams, configParams) { | ||
const suggestion = (p) => { | ||
const sortInt = (a, b) => { | ||
return a[0] - b[0]; | ||
}; | ||
const arr = Object.keys(configParams).map(param => [levenshtein(p, param), param]); | ||
return arr.sort(sortInt)[0][1]; | ||
}; | ||
if (configParams) { | ||
wrongParams.forEach(wp => console.warn(`Did you mean "${Object.keys(configParams) | ||
.map(param => [levenshtein(wp, param), param]).sort()[0][1]}"?`)); | ||
wrongParams.forEach(wp => console.warn(`Did you mean "${suggestion(wp)}"?`)); | ||
} else { | ||
@@ -73,0 +81,0 @@ console.warn('This template doesn\'t have any params!'); |
{ | ||
"name": "@asyncapi/generator", | ||
"version": "0.51.0", | ||
"version": "0.51.1", | ||
"description": "The AsyncAPI generator. It can generate documentation, code, anything!", | ||
@@ -5,0 +5,0 @@ "main": "./lib/generator.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119508
1394