u
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import zd41x from './zd41x.png';
|
||||
|
||||
// Library of printer images, keyed by printer model (as reported by the agent).
|
||||
const PRINTER_IMAGES = {
|
||||
'ZD410-200dpi': zd41x,
|
||||
};
|
||||
// Library of printer images. Entries are matched in order against the
|
||||
// printer model (as reported by the agent), case-insensitively.
|
||||
const PRINTER_IMAGES = [
|
||||
{ pattern: /^ZD41/i, image: zd41x }, // ZD410, ZD411, ZD410-200dpi, ...
|
||||
];
|
||||
|
||||
export function getPrinterImage(model) {
|
||||
return (model && PRINTER_IMAGES[model]) || null;
|
||||
if (!model) return null;
|
||||
const entry = PRINTER_IMAGES.find(({ pattern }) => pattern.test(String(model).trim()));
|
||||
return entry?.image ?? null;
|
||||
}
|
||||
|
||||
export default PRINTER_IMAGES;
|
||||
|
||||
Reference in New Issue
Block a user