1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 13:00:58 -05:00
Daggerbot-TS/src/helpers/PalletLibrary.ts
2023-12-25 14:02:59 +11:00

11 lines
313 B
TypeScript

import {FSData} from 'src/interfaces';
export default function(data:FSData) {
const pallets = data.vehicles.filter(x=>x.category === 'PALLETS');
const counts = pallets.reduce((acc, name)=>{
acc[name.name] = (acc[name.name] ?? 0) + 1;
return acc;
}, {} as {[key:string]:number});
return counts;
}