@netlify/content-engine
Version:
38 lines • 1.12 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KNOWN_CONFIG_KEYS = void 0;
exports.didYouMean = didYouMean;
const meant_1 = __importDefault(require("meant"));
exports.KNOWN_CONFIG_KEYS = [
`flags`,
`polyfill`,
`assetPrefix`,
`pathPrefix`,
`siteMetadata`,
`mapping`,
`plugins`,
`proxy`,
`developMiddleware`,
`jsxRuntime`,
`jsxImportSource`,
`trailingSlash`,
`graphqlTypegen`,
];
function didYouMean(configKey, commands = exports.KNOWN_CONFIG_KEYS) {
const bestSimilarity = (0, meant_1.default)(configKey, commands);
if (bestSimilarity.length === 0)
return ``;
if (bestSimilarity.length === 1) {
return `Did you mean "${bestSimilarity[0]}"?`;
}
else {
return ([`Did you mean one of these?`]
.concat(bestSimilarity.slice(0, 3))
.join(`\n`) + `\n`);
}
}
exports.default = didYouMean;
//# sourceMappingURL=did-you-mean.js.map
;