{"version":3,"file":"millify.C_3DdzUk.mjs","names":[],"sources":["https:/framerusercontent.com/modules/TbfONFeGM5NK9kIAQu9P/Iv2YlQQp8itk7rvwklqF/millify.js"],"sourcesContent":["// Default options for millify function\nconst defaultOptions={units:[\"\",\"K\",\"M\",\"B\",\"T\"],precision:2};// Utility function to parse input value\nfunction parseValue(value){return isNaN(value)?0:Number(value);}// Utility function to round number to specified precision\nfunction roundTo(value,precision){const multiplier=Math.pow(10,precision);return Math.round(value*multiplier)/multiplier;}// Generator function to divide the number until a suitable unit is found\nfunction*divider(value){let index=0;while(value>=1e3&&index<defaultOptions.units.length-1){value/=1e3;index++;yield{value,index};}}// The main millify function to convert numbers to human-readable strings\nfunction millify(value,options={}){// Merge default options with user-provided options\nconst opts={...defaultOptions,...options};let parsedValue=parseValue(value);let unitIndex=0;// Use the divider generator to find the appropriate unit and value\nfor(const result of divider(parsedValue)){parsedValue=result.value;unitIndex=result.index;}// Round the value to the desired precision\nconst roundedValue=roundTo(parsedValue,opts.precision);// Construct the final string with the unit\nreturn`${roundedValue}${opts.units[unitIndex]}`;}// Export the millify function for external use\nexport{millify};export default millify;\nexport const __FramerMetadata__ = {\"exports\":{\"millify\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./millify.map"],"mappings":"2DAEA,SAAS,EAAW,EAAM,CAAC,OAAO,MAAM,EAAM,CAAC,EAAE,OAAO,EAAM,CAC9D,SAAS,EAAQ,EAAM,EAAU,CAAC,IAAM,EAAoB,IAAG,EAAW,OAAO,KAAK,MAAM,EAAM,EAAW,CAAC,EAC9G,SAAS,EAAQ,EAAM,CAAC,IAAI,EAAM,EAAE,KAAM,GAAO,KAAK,EAAM,EAAe,MAAM,OAAO,GAAG,GAAO,IAAI,IAAQ,KAAK,CAAC,QAAM,QAAM,CAChI,SAAS,EAAQ,EAAM,EAAQ,EAAE,CAAC,CAClC,IAAM,EAAK,CAAC,GAAG,EAAe,GAAG,EAAQ,CAAK,EAAY,EAAW,EAAM,CAAK,EAAU,EAC1F,IAAI,IAAM,KAAU,EAAQ,EAAY,CAAE,EAAY,EAAO,MAAM,EAAU,EAAO,MAEpF,MAAM,GADa,EAAQ,EAAY,EAAK,UAAU,GAC9B,EAAK,MAAM,uBAR7B,EAAe,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,GAS9B"}