xero-hero
Version:
Heroic utilities to simplify and enable your progress with the [xero-node](https://www.npmjs.com/package/xero-node) SDK.
1 lines • 936 B
Source Map (JSON)
{"version":3,"sources":["../../src/projects/timeEntries.ts"],"sourcesContent":["import { roundToNearestFraction } from 'deep-cuts';\r\n\r\nimport type { TimeEntry } from './shimTypes';\r\n\r\nexport const hoursFromTimeEntries = (\r\n timeEntries: TimeEntry[],\r\n denominator: number = 4,\r\n maxDecimalPlaces: number = 2,\r\n): number | undefined => {\r\n const totalMinutes = timeEntries.reduce((totalMinutes, timeEntry) => {\r\n const duration = timeEntry.duration || 0;\r\n return totalMinutes + duration;\r\n }, 0);\r\n return roundToNearestFraction(\r\n totalMinutes / 60,\r\n denominator,\r\n maxDecimalPlaces,\r\n );\r\n};\r\n"],"mappings":";AAAA,SAAS,8BAA8B;AAIhC,IAAM,uBAAuB,CAClC,aACA,cAAsB,GACtB,mBAA2B,MACJ;AACvB,QAAM,eAAe,YAAY,OAAO,CAACA,eAAc,cAAc;AACnE,UAAM,WAAW,UAAU,YAAY;AACvC,WAAOA,gBAAe;AAAA,EACxB,GAAG,CAAC;AACJ,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,IACA;AAAA,EACF;AACF;","names":["totalMinutes"]}