Files
klz-cables.com/.pnpm-store/v10/files/9b/edb8efd9a103eab39296028f3befa745343f7816973c990bb8571133164a6bb3dc6f5b052920e93cf487e89d7a14cc56856384bcefa893f790cf75f17c9842
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

39 lines
879 B
Plaintext

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.didYouMean = didYouMean;
const MAX_SUGGESTIONS = 5;
/**
* Given [ A, B, C ] return ' Did you mean A, B, or C?'.
*/
function didYouMean(firstArg, secondArg) {
const [subMessage, suggestionsArg] = secondArg
? [firstArg, secondArg]
: [undefined, firstArg];
let message = ' Did you mean ';
if (subMessage) {
message += subMessage + ' ';
}
const suggestions = suggestionsArg.map((x) => `"${x}"`);
switch (suggestions.length) {
case 0:
return '';
case 1:
return message + suggestions[0] + '?';
case 2:
return message + suggestions[0] + ' or ' + suggestions[1] + '?';
}
const selected = suggestions.slice(0, MAX_SUGGESTIONS);
const lastItem = selected.pop();
return message + selected.join(', ') + ', or ' + lastItem + '?';
}