MCPcopy Create free account
hub / github.com/PartPilotLab/PartPilot / scannerInputToType

Function scannerInputToType

app/dashboardPage.tsx:45–63  ·  view source on GitHub ↗
(partScannerInput: string)

Source from the content-addressed store, hash-verified

43import { useForm } from "@mantine/form";
44
45export function scannerInputToType(partScannerInput: string): ScannerPartState {
46 var json = {} as { [key: string]: string };
47 if (partScannerInput) {
48 partScannerInput.split(",").forEach((item) => {
49 var key = item.split(":")[0];
50 var value = item.split(":")[1];
51 json[key] = value;
52 });
53 var pmVal = json.pm;
54 var qtyVal = json.qty;
55 var pdi = json.pdi;
56 var pc = json.pc;
57 var on = json.on;
58 var pbn = json.pbn;
59
60 return { pm: pmVal, qty: Number(qtyVal), pdi, pc, on, pbn };
61 }
62 return { pm: "", qty: 0, pc: "", error: true };
63}
64export interface ScannerPartState {
65 pbn?: string;
66 on?: string;

Callers 2

handleAutocompleteFunction · 0.90
DashboardPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected