MCPcopy
hub / github.com/frappe/erpnext / strip_number_groups

Function strip_number_groups

banking/src/lib/numbers.ts:150–165  ·  view source on GitHub ↗
(v: string, number_format?: string)

Source from the content-addressed store, hash-verified

148}
149
150function strip_number_groups(v: string, number_format?: string) {
151 if (!number_format) number_format = get_number_format();
152 const info = get_number_format_info(number_format);
153
154 // strip groups (,)
155 const group_regex = new RegExp(info.group_sep === "." ? "\\." : info.group_sep, "g");
156 v = v.replace(group_regex, "");
157
158 // replace decimal separator with (.)
159 if (info.decimal_str !== "." && info.decimal_str !== "") {
160 const decimal_regex = new RegExp(info.decimal_str, "g");
161 v = v.replace(decimal_regex, ".");
162 }
163
164 return v;
165}
166
167const _round = (num: number, precision: number, rounding_method?: string) => {
168

Callers 1

fltFunction · 0.85

Calls 2

get_number_formatFunction · 0.85
get_number_format_infoFunction · 0.85

Tested by

no test coverage detected