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