{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["export type TGetStrWithThousandSeparatorArgs = Parameters<typeof getStrWithThousandSeparator>;\r\n\r\nexport type TGetStrWithThousandSeparatorReturn = ReturnType<typeof getStrWithThousandSeparator>;\r\n\r\n/**\r\n * Gets a formatted string with thousands separators from given number. This is a simple formatter for integer parts and does not handle locales or decimals.\r\n *\r\n * @param {number} num Source number\r\n * @param {string} [separator=\" \"] Separator to insert between each group of three digits\r\n * @returns {string} Formatted string\r\n * @example\r\n * getStrWithThousandSeparator(1000000, \",\"); // \"1,000,000\"\r\n */\r\nexport const getStrWithThousandSeparator = (num: number, separator: string = \" \"): string => {\r\n  if (!Number.isFinite(num)) {\r\n    throw new TypeError(\"getStrWithThousandSeparator: num must be a finite number\");\r\n  }\r\n  if (typeof separator !== \"string\") {\r\n    throw new TypeError(\"getStrWithThousandSeparator: separator must be a string\");\r\n  }\r\n  // eslint-disable-next-line security/detect-unsafe-regex\r\n  return num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, separator);\r\n};\r\n"],"names":["getStrWithThousandSeparator","num","separator","Number","isFinite","TypeError","toString","replace"],"mappings":";;;;;;;;;GAaO,MAAMA,4BAA8BA,CAACC,IAAaC,UAAoB,OAC3E,IAAKC,OAAOC,SAASH,KACnB,MAAM,IAAII,UAAU,4DAEtB,UAAWH,YAAc,SACvB,MAAM,IAAIG,UAAU;wDAGtB;OAAOJ,IAAIK,WAAWC,QAAQ,wBAAyBL"}