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 • 1.46 kB
Source Map (JSON)
{"version":3,"sources":["../../src/projects/generators.ts","../../src/projects/timeEntries.ts"],"sourcesContent":["import type { Amount, CurrencyCode } from './shimTypes';\r\n\r\nexport const generateProjectAmountUSD = (value: number): Amount => {\r\n const amount = {} as Amount;\r\n /* eslint-disable functional/immutable-data */\r\n amount.currency = 'USD' as unknown as CurrencyCode;\r\n amount.value = value;\r\n /* eslint-enable functional/immutable-data */\r\n return amount;\r\n};\r\n","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":";AAEO,IAAM,2BAA2B,CAAC,UAA0B;AACjE,QAAM,SAAS,CAAC;AAEhB,SAAO,WAAW;AAClB,SAAO,QAAQ;AAEf,SAAO;AACT;;;ACTA,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"]}