kolchoz
Version:
Calculate your earnings in real-time based on your rate and country-specific working hours.
2 lines • 538 B
JavaScript
import{getCountryData as u}from"countries-list";import c from"dutyhours";function l(y){let{country:n,currency:a=u(n).currency[0],...t}=y;if(Object.keys(t).length!==1)throw new Error("Exactly one rate type (monthly, daily, hourly) must be provided.");let e=Object.keys(t)[0],o=t[e],r;if(e==="monthly")r=o/c({country:n})/60/60;else if(e==="daily")r=o/8/60/60;else if(e==="hourly")r=o/60/60;else throw new Error("Invalid rate type provided.");return{currency:a,ratePerSecond:r}}var m=l;export{m as default};
//# sourceMappingURL=index.js.map