Nothing ish about the new check

This commit is contained in:
Filipe Dobreira 2023-12-07 21:43:40 +00:00
parent 8d0575937c
commit 0e9aa805e1

View file

@ -19,9 +19,9 @@ function isCodeFragment(event: KeyboardEvent): boolean {
}
/**
* Performs a naive check to ensure something is a EAN13 or UPC-A code.
* Performs a check to ensure something is a EAN13 or UPC-A code.
*/
function isValidIshCode(code: string): boolean {
function isValidCode(code: string): boolean {
try {
// We check the format in advance, since we're only accepting EAN13 and UPC-A here.
// There's no -real- reason for this limitation, besides protecting against feature
@ -93,7 +93,7 @@ export function useQuickSearch() {
// Reset the buffer:
codeBuffer.value = fragment;
}
} else if (event.key === "Enter" && isValidIshCode(codeBuffer.value)) {
} else if (event.key === "Enter" && isValidCode(codeBuffer.value)) {
// If we have an active code buffer that seems valid, and the user presses Enter,
// we want to generate a new search query from this code, as long as it seems valid.
//
@ -130,7 +130,6 @@ export function useQuickSearch() {
});
return {
codeBuffer,
isActive,
};
}