@_henriquewilson/gabirubi-domain 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/iugu/iugu-invoice.d.mts +2 -2
- package/dist/model/iugu/iugu-invoice.d.ts +2 -2
- package/dist/model/journey.d.mts +2 -2
- package/dist/model/journey.d.ts +2 -2
- package/dist/model/purchase.d.mts +2 -2
- package/dist/model/purchase.d.ts +2 -2
- package/dist/model/subscription.model.d.mts +4 -4
- package/dist/model/subscription.model.d.ts +4 -4
- package/dist/util/number.utils.js +1 -1
- package/dist/util/number.utils.js.map +1 -1
- package/dist/util/number.utils.mjs +1 -1
- package/dist/util/number.utils.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -223,8 +223,8 @@ declare const IuguInvoiceSchema: z.ZodObject<{
|
|
|
223
223
|
early_payment_discounts: z.ZodArray<z.ZodUnknown, "many">;
|
|
224
224
|
split_rules: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
225
225
|
}, "strip", z.ZodTypeAny, {
|
|
226
|
-
id: string;
|
|
227
226
|
status: string;
|
|
227
|
+
id: string;
|
|
228
228
|
due_date: string;
|
|
229
229
|
currency: string;
|
|
230
230
|
email: string;
|
|
@@ -375,8 +375,8 @@ declare const IuguInvoiceSchema: z.ZodObject<{
|
|
|
375
375
|
financial_return_dates?: string | null | undefined;
|
|
376
376
|
split_rules?: string | null | undefined;
|
|
377
377
|
}, {
|
|
378
|
-
id: string;
|
|
379
378
|
status: string;
|
|
379
|
+
id: string;
|
|
380
380
|
due_date: string;
|
|
381
381
|
currency: string;
|
|
382
382
|
email: string;
|
|
@@ -223,8 +223,8 @@ declare const IuguInvoiceSchema: z.ZodObject<{
|
|
|
223
223
|
early_payment_discounts: z.ZodArray<z.ZodUnknown, "many">;
|
|
224
224
|
split_rules: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
225
225
|
}, "strip", z.ZodTypeAny, {
|
|
226
|
-
id: string;
|
|
227
226
|
status: string;
|
|
227
|
+
id: string;
|
|
228
228
|
due_date: string;
|
|
229
229
|
currency: string;
|
|
230
230
|
email: string;
|
|
@@ -375,8 +375,8 @@ declare const IuguInvoiceSchema: z.ZodObject<{
|
|
|
375
375
|
financial_return_dates?: string | null | undefined;
|
|
376
376
|
split_rules?: string | null | undefined;
|
|
377
377
|
}, {
|
|
378
|
-
id: string;
|
|
379
378
|
status: string;
|
|
379
|
+
id: string;
|
|
380
380
|
due_date: string;
|
|
381
381
|
currency: string;
|
|
382
382
|
email: string;
|
package/dist/model/journey.d.mts
CHANGED
|
@@ -220,6 +220,7 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
220
220
|
description?: string | undefined;
|
|
221
221
|
}>, "many">;
|
|
222
222
|
}>, "strip", z.ZodTypeAny, {
|
|
223
|
+
title: string;
|
|
223
224
|
activities: {
|
|
224
225
|
title: string;
|
|
225
226
|
contentType: "video" | "file" | "audio" | "text";
|
|
@@ -231,7 +232,6 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
231
232
|
publishOnDate?: FirebaseFirestore.Timestamp | undefined;
|
|
232
233
|
description?: string | undefined;
|
|
233
234
|
}[];
|
|
234
|
-
title: string;
|
|
235
235
|
id?: string | null | undefined;
|
|
236
236
|
order?: number | null | undefined;
|
|
237
237
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
@@ -244,6 +244,7 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
244
244
|
}[] | undefined;
|
|
245
245
|
publishOnDate?: FirebaseFirestore.Timestamp | undefined;
|
|
246
246
|
}, {
|
|
247
|
+
title: string;
|
|
247
248
|
activities: {
|
|
248
249
|
title: string;
|
|
249
250
|
contentType: "video" | "file" | "audio" | "text";
|
|
@@ -255,7 +256,6 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
255
256
|
publishOnDate?: unknown;
|
|
256
257
|
description?: string | undefined;
|
|
257
258
|
}[];
|
|
258
|
-
title: string;
|
|
259
259
|
id?: string | null | undefined;
|
|
260
260
|
order?: number | null | undefined;
|
|
261
261
|
createAt?: unknown;
|
package/dist/model/journey.d.ts
CHANGED
|
@@ -220,6 +220,7 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
220
220
|
description?: string | undefined;
|
|
221
221
|
}>, "many">;
|
|
222
222
|
}>, "strip", z.ZodTypeAny, {
|
|
223
|
+
title: string;
|
|
223
224
|
activities: {
|
|
224
225
|
title: string;
|
|
225
226
|
contentType: "video" | "file" | "audio" | "text";
|
|
@@ -231,7 +232,6 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
231
232
|
publishOnDate?: FirebaseFirestore.Timestamp | undefined;
|
|
232
233
|
description?: string | undefined;
|
|
233
234
|
}[];
|
|
234
|
-
title: string;
|
|
235
235
|
id?: string | null | undefined;
|
|
236
236
|
order?: number | null | undefined;
|
|
237
237
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
@@ -244,6 +244,7 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
244
244
|
}[] | undefined;
|
|
245
245
|
publishOnDate?: FirebaseFirestore.Timestamp | undefined;
|
|
246
246
|
}, {
|
|
247
|
+
title: string;
|
|
247
248
|
activities: {
|
|
248
249
|
title: string;
|
|
249
250
|
contentType: "video" | "file" | "audio" | "text";
|
|
@@ -255,7 +256,6 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
255
256
|
publishOnDate?: unknown;
|
|
256
257
|
description?: string | undefined;
|
|
257
258
|
}[];
|
|
258
|
-
title: string;
|
|
259
259
|
id?: string | null | undefined;
|
|
260
260
|
order?: number | null | undefined;
|
|
261
261
|
createAt?: unknown;
|
|
@@ -94,7 +94,6 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
94
94
|
updateAt?: unknown;
|
|
95
95
|
}>, "many">;
|
|
96
96
|
}>, "strip", z.ZodTypeAny, {
|
|
97
|
-
completionCounter: number;
|
|
98
97
|
activities: {
|
|
99
98
|
completionPercentage: number;
|
|
100
99
|
id?: string | null | undefined;
|
|
@@ -102,12 +101,12 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
102
101
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
103
102
|
updateAt?: FirebaseFirestore.Timestamp | undefined;
|
|
104
103
|
}[];
|
|
104
|
+
completionCounter: number;
|
|
105
105
|
id?: string | null | undefined;
|
|
106
106
|
order?: number | null | undefined;
|
|
107
107
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
108
108
|
updateAt?: FirebaseFirestore.Timestamp | undefined;
|
|
109
109
|
}, {
|
|
110
|
-
completionCounter: number;
|
|
111
110
|
activities: {
|
|
112
111
|
completionPercentage: number;
|
|
113
112
|
id?: string | null | undefined;
|
|
@@ -115,6 +114,7 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
115
114
|
createAt?: unknown;
|
|
116
115
|
updateAt?: unknown;
|
|
117
116
|
}[];
|
|
117
|
+
completionCounter: number;
|
|
118
118
|
id?: string | null | undefined;
|
|
119
119
|
order?: number | null | undefined;
|
|
120
120
|
createAt?: unknown;
|
package/dist/model/purchase.d.ts
CHANGED
|
@@ -94,7 +94,6 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
94
94
|
updateAt?: unknown;
|
|
95
95
|
}>, "many">;
|
|
96
96
|
}>, "strip", z.ZodTypeAny, {
|
|
97
|
-
completionCounter: number;
|
|
98
97
|
activities: {
|
|
99
98
|
completionPercentage: number;
|
|
100
99
|
id?: string | null | undefined;
|
|
@@ -102,12 +101,12 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
102
101
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
103
102
|
updateAt?: FirebaseFirestore.Timestamp | undefined;
|
|
104
103
|
}[];
|
|
104
|
+
completionCounter: number;
|
|
105
105
|
id?: string | null | undefined;
|
|
106
106
|
order?: number | null | undefined;
|
|
107
107
|
createAt?: FirebaseFirestore.Timestamp | undefined;
|
|
108
108
|
updateAt?: FirebaseFirestore.Timestamp | undefined;
|
|
109
109
|
}, {
|
|
110
|
-
completionCounter: number;
|
|
111
110
|
activities: {
|
|
112
111
|
completionPercentage: number;
|
|
113
112
|
id?: string | null | undefined;
|
|
@@ -115,6 +114,7 @@ declare const ModuleProgressWithActivities: z.ZodObject<z.objectUtil.extendShape
|
|
|
115
114
|
createAt?: unknown;
|
|
116
115
|
updateAt?: unknown;
|
|
117
116
|
}[];
|
|
117
|
+
completionCounter: number;
|
|
118
118
|
id?: string | null | undefined;
|
|
119
119
|
order?: number | null | undefined;
|
|
120
120
|
createAt?: unknown;
|
|
@@ -229,8 +229,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
229
229
|
early_payment_discounts: z.ZodArray<z.ZodUnknown, "many">;
|
|
230
230
|
split_rules: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
231
231
|
}, "strip", z.ZodTypeAny, {
|
|
232
|
-
id: string;
|
|
233
232
|
status: string;
|
|
233
|
+
id: string;
|
|
234
234
|
due_date: string;
|
|
235
235
|
currency: string;
|
|
236
236
|
email: string;
|
|
@@ -381,8 +381,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
381
381
|
financial_return_dates?: string | null | undefined;
|
|
382
382
|
split_rules?: string | null | undefined;
|
|
383
383
|
}, {
|
|
384
|
-
id: string;
|
|
385
384
|
status: string;
|
|
385
|
+
id: string;
|
|
386
386
|
due_date: string;
|
|
387
387
|
currency: string;
|
|
388
388
|
email: string;
|
|
@@ -570,8 +570,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
570
570
|
portalEmail: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
571
571
|
}>, "strip", z.ZodTypeAny, {
|
|
572
572
|
invoice: {
|
|
573
|
-
id: string;
|
|
574
573
|
status: string;
|
|
574
|
+
id: string;
|
|
575
575
|
due_date: string;
|
|
576
576
|
currency: string;
|
|
577
577
|
email: string;
|
|
@@ -741,8 +741,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
741
741
|
portalEmail?: string | null | undefined;
|
|
742
742
|
}, {
|
|
743
743
|
invoice: {
|
|
744
|
-
id: string;
|
|
745
744
|
status: string;
|
|
745
|
+
id: string;
|
|
746
746
|
due_date: string;
|
|
747
747
|
currency: string;
|
|
748
748
|
email: string;
|
|
@@ -229,8 +229,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
229
229
|
early_payment_discounts: z.ZodArray<z.ZodUnknown, "many">;
|
|
230
230
|
split_rules: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
231
231
|
}, "strip", z.ZodTypeAny, {
|
|
232
|
-
id: string;
|
|
233
232
|
status: string;
|
|
233
|
+
id: string;
|
|
234
234
|
due_date: string;
|
|
235
235
|
currency: string;
|
|
236
236
|
email: string;
|
|
@@ -381,8 +381,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
381
381
|
financial_return_dates?: string | null | undefined;
|
|
382
382
|
split_rules?: string | null | undefined;
|
|
383
383
|
}, {
|
|
384
|
-
id: string;
|
|
385
384
|
status: string;
|
|
385
|
+
id: string;
|
|
386
386
|
due_date: string;
|
|
387
387
|
currency: string;
|
|
388
388
|
email: string;
|
|
@@ -570,8 +570,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
570
570
|
portalEmail: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
571
571
|
}>, "strip", z.ZodTypeAny, {
|
|
572
572
|
invoice: {
|
|
573
|
-
id: string;
|
|
574
573
|
status: string;
|
|
574
|
+
id: string;
|
|
575
575
|
due_date: string;
|
|
576
576
|
currency: string;
|
|
577
577
|
email: string;
|
|
@@ -741,8 +741,8 @@ declare const SubscriptionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
741
741
|
portalEmail?: string | null | undefined;
|
|
742
742
|
}, {
|
|
743
743
|
invoice: {
|
|
744
|
-
id: string;
|
|
745
744
|
status: string;
|
|
745
|
+
id: string;
|
|
746
746
|
due_date: string;
|
|
747
747
|
currency: string;
|
|
748
748
|
email: string;
|
|
@@ -112,7 +112,7 @@ var calculatePercentage = function(currentValue, totalValue) {
|
|
|
112
112
|
return currentValue / totalValue * 100;
|
|
113
113
|
};
|
|
114
114
|
var currency = function(value) {
|
|
115
|
-
var maximumFractionDigits = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
115
|
+
var maximumFractionDigits = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
|
|
116
116
|
var currencyFormatter = Intl.NumberFormat("pt-BR", {
|
|
117
117
|
style: "currency",
|
|
118
118
|
currency: "BRL",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/number.utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqB;AAEd,IAAM,kBAAkB,CAAC,GAAW,wBAAwB,MAAc;AAC/E,QAAM,UAAU,EAAE,sBAAsB;AACxC,SAAO,KAAK,aAAa,SAAS,OAAO,EAAE,OAAO,CAAC;AACrD;AAEO,IAAM,gBAAgB,CAAC,GAAW,wBAAwB,MAAc;AAC7E,SAAO,WAAW,EAAE,QAAQ,qBAAqB,CAAC;AACpD;AAEO,IAAM,mBAAmB,CAAC,QAAgB;AAC/C,SAAO,MAAM,MAAM;AACrB;AAEO,IAAM,oBAAoB,CAAC,MAAsB;AACtD,MAAI,IAAI,KAAM;AACZ,WAAO,GAAG,gBAAgB,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,GAAG,gBAAgB,IAAI,KAAM,CAAC,CAAC;AACxC;AAEO,IAAM,gBAAgB,CAAC,MAAsB;AAClD,QAAM,QAAI,oBAAK,KAAK,CAAC;AACrB,MAAI,IAAI,IAAI;AACV,WAAO,GAAG,cAAc,IAAI,EAAE,CAAC;AAAA,EACjC;AACA,SAAO,GAAG,CAAC;AACb;AAEO,IAAM,sBAAsB,CAAC,MAAsB;AACxD,SAAO,OAAO,gBAAgB,IAAI,GAAG,CAAC;AACxC;AAEO,IAAM,sBAAsB,CAAC,cAAsB,eAAuB;AAC/E,MAAI,eAAe,GAAG;AACpB,WAAO;AAAA,EACT;AACA,SAAQ,eAAe,aAAc;AACvC;AAEO,IAAM,WAAW,CAAC,OAAe,wBAAwB,MAAM;AACpE,QAAM,oBAAoB,KAAK,aAAa,SAAS;AAAA,IACnD,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO,KAAK;AACvC","sourcesContent":["import { ceil } from 'lodash';\n\nexport const formatterNumber = (n: number, maximumFractionDigits = 0): string => {\n const options = { maximumFractionDigits };\n return Intl.NumberFormat('pt-BR', options).format(n);\n};\n\nexport const roundedNumber = (n: number, maximumFractionDigits = 0): number => {\n return parseFloat(n.toFixed(maximumFractionDigits));\n};\n\nexport const hasDecimalPlaces = (num: number) => {\n return num % 1 !== 0;\n};\n\nexport const formatterDistance = (n: number): string => {\n if (n < 1000) {\n return `${formatterNumber(n)} m`;\n }\n return `${formatterNumber(n / 1000, 1)} km`;\n};\n\nexport const formatterTime = (n: number): string => {\n const s = ceil(n || 0);\n if (s > 59) {\n return `${roundedNumber(s / 60)} h`;\n }\n return `${s} min`;\n};\n\nexport const percentageOfHundred = (n: number): number => {\n return Number(formatterNumber(n * 100));\n};\n\nexport const calculatePercentage = (currentValue: number, totalValue: number) => {\n if (totalValue === 0) {\n return 0;\n }\n return (currentValue / totalValue) * 100;\n};\n\nexport const currency = (value: number, maximumFractionDigits =
|
|
1
|
+
{"version":3,"sources":["../../src/util/number.utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqB;AAEd,IAAM,kBAAkB,CAAC,GAAW,wBAAwB,MAAc;AAC/E,QAAM,UAAU,EAAE,sBAAsB;AACxC,SAAO,KAAK,aAAa,SAAS,OAAO,EAAE,OAAO,CAAC;AACrD;AAEO,IAAM,gBAAgB,CAAC,GAAW,wBAAwB,MAAc;AAC7E,SAAO,WAAW,EAAE,QAAQ,qBAAqB,CAAC;AACpD;AAEO,IAAM,mBAAmB,CAAC,QAAgB;AAC/C,SAAO,MAAM,MAAM;AACrB;AAEO,IAAM,oBAAoB,CAAC,MAAsB;AACtD,MAAI,IAAI,KAAM;AACZ,WAAO,GAAG,gBAAgB,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,GAAG,gBAAgB,IAAI,KAAM,CAAC,CAAC;AACxC;AAEO,IAAM,gBAAgB,CAAC,MAAsB;AAClD,QAAM,QAAI,oBAAK,KAAK,CAAC;AACrB,MAAI,IAAI,IAAI;AACV,WAAO,GAAG,cAAc,IAAI,EAAE,CAAC;AAAA,EACjC;AACA,SAAO,GAAG,CAAC;AACb;AAEO,IAAM,sBAAsB,CAAC,MAAsB;AACxD,SAAO,OAAO,gBAAgB,IAAI,GAAG,CAAC;AACxC;AAEO,IAAM,sBAAsB,CAAC,cAAsB,eAAuB;AAC/E,MAAI,eAAe,GAAG;AACpB,WAAO;AAAA,EACT;AACA,SAAQ,eAAe,aAAc;AACvC;AAEO,IAAM,WAAW,CAAC,OAAe,wBAAwB,MAAM;AACpE,QAAM,oBAAoB,KAAK,aAAa,SAAS;AAAA,IACnD,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO,KAAK;AACvC","sourcesContent":["import { ceil } from 'lodash';\n\nexport const formatterNumber = (n: number, maximumFractionDigits = 0): string => {\n const options = { maximumFractionDigits };\n return Intl.NumberFormat('pt-BR', options).format(n);\n};\n\nexport const roundedNumber = (n: number, maximumFractionDigits = 0): number => {\n return parseFloat(n.toFixed(maximumFractionDigits));\n};\n\nexport const hasDecimalPlaces = (num: number) => {\n return num % 1 !== 0;\n};\n\nexport const formatterDistance = (n: number): string => {\n if (n < 1000) {\n return `${formatterNumber(n)} m`;\n }\n return `${formatterNumber(n / 1000, 1)} km`;\n};\n\nexport const formatterTime = (n: number): string => {\n const s = ceil(n || 0);\n if (s > 59) {\n return `${roundedNumber(s / 60)} h`;\n }\n return `${s} min`;\n};\n\nexport const percentageOfHundred = (n: number): number => {\n return Number(formatterNumber(n * 100));\n};\n\nexport const calculatePercentage = (currentValue: number, totalValue: number) => {\n if (totalValue === 0) {\n return 0;\n }\n return (currentValue / totalValue) * 100;\n};\n\nexport const currency = (value: number, maximumFractionDigits = 2) => {\n const currencyFormatter = Intl.NumberFormat('pt-BR', {\n style: 'currency',\n currency: 'BRL',\n maximumFractionDigits,\n });\n return currencyFormatter.format(value);\n};\n"]}
|
|
@@ -32,7 +32,7 @@ var calculatePercentage = (currentValue, totalValue) => {
|
|
|
32
32
|
}
|
|
33
33
|
return currentValue / totalValue * 100;
|
|
34
34
|
};
|
|
35
|
-
var currency = (value, maximumFractionDigits =
|
|
35
|
+
var currency = (value, maximumFractionDigits = 2) => {
|
|
36
36
|
const currencyFormatter = Intl.NumberFormat("pt-BR", {
|
|
37
37
|
style: "currency",
|
|
38
38
|
currency: "BRL",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/number.utils.ts"],"sourcesContent":["import { ceil } from 'lodash';\n\nexport const formatterNumber = (n: number, maximumFractionDigits = 0): string => {\n const options = { maximumFractionDigits };\n return Intl.NumberFormat('pt-BR', options).format(n);\n};\n\nexport const roundedNumber = (n: number, maximumFractionDigits = 0): number => {\n return parseFloat(n.toFixed(maximumFractionDigits));\n};\n\nexport const hasDecimalPlaces = (num: number) => {\n return num % 1 !== 0;\n};\n\nexport const formatterDistance = (n: number): string => {\n if (n < 1000) {\n return `${formatterNumber(n)} m`;\n }\n return `${formatterNumber(n / 1000, 1)} km`;\n};\n\nexport const formatterTime = (n: number): string => {\n const s = ceil(n || 0);\n if (s > 59) {\n return `${roundedNumber(s / 60)} h`;\n }\n return `${s} min`;\n};\n\nexport const percentageOfHundred = (n: number): number => {\n return Number(formatterNumber(n * 100));\n};\n\nexport const calculatePercentage = (currentValue: number, totalValue: number) => {\n if (totalValue === 0) {\n return 0;\n }\n return (currentValue / totalValue) * 100;\n};\n\nexport const currency = (value: number, maximumFractionDigits =
|
|
1
|
+
{"version":3,"sources":["../../src/util/number.utils.ts"],"sourcesContent":["import { ceil } from 'lodash';\n\nexport const formatterNumber = (n: number, maximumFractionDigits = 0): string => {\n const options = { maximumFractionDigits };\n return Intl.NumberFormat('pt-BR', options).format(n);\n};\n\nexport const roundedNumber = (n: number, maximumFractionDigits = 0): number => {\n return parseFloat(n.toFixed(maximumFractionDigits));\n};\n\nexport const hasDecimalPlaces = (num: number) => {\n return num % 1 !== 0;\n};\n\nexport const formatterDistance = (n: number): string => {\n if (n < 1000) {\n return `${formatterNumber(n)} m`;\n }\n return `${formatterNumber(n / 1000, 1)} km`;\n};\n\nexport const formatterTime = (n: number): string => {\n const s = ceil(n || 0);\n if (s > 59) {\n return `${roundedNumber(s / 60)} h`;\n }\n return `${s} min`;\n};\n\nexport const percentageOfHundred = (n: number): number => {\n return Number(formatterNumber(n * 100));\n};\n\nexport const calculatePercentage = (currentValue: number, totalValue: number) => {\n if (totalValue === 0) {\n return 0;\n }\n return (currentValue / totalValue) * 100;\n};\n\nexport const currency = (value: number, maximumFractionDigits = 2) => {\n const currencyFormatter = Intl.NumberFormat('pt-BR', {\n style: 'currency',\n currency: 'BRL',\n maximumFractionDigits,\n });\n return currencyFormatter.format(value);\n};\n"],"mappings":";AAAA,SAAS,YAAY;AAEd,IAAM,kBAAkB,CAAC,GAAW,wBAAwB,MAAc;AAC/E,QAAM,UAAU,EAAE,sBAAsB;AACxC,SAAO,KAAK,aAAa,SAAS,OAAO,EAAE,OAAO,CAAC;AACrD;AAEO,IAAM,gBAAgB,CAAC,GAAW,wBAAwB,MAAc;AAC7E,SAAO,WAAW,EAAE,QAAQ,qBAAqB,CAAC;AACpD;AAEO,IAAM,mBAAmB,CAAC,QAAgB;AAC/C,SAAO,MAAM,MAAM;AACrB;AAEO,IAAM,oBAAoB,CAAC,MAAsB;AACtD,MAAI,IAAI,KAAM;AACZ,WAAO,GAAG,gBAAgB,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,GAAG,gBAAgB,IAAI,KAAM,CAAC,CAAC;AACxC;AAEO,IAAM,gBAAgB,CAAC,MAAsB;AAClD,QAAM,IAAI,KAAK,KAAK,CAAC;AACrB,MAAI,IAAI,IAAI;AACV,WAAO,GAAG,cAAc,IAAI,EAAE,CAAC;AAAA,EACjC;AACA,SAAO,GAAG,CAAC;AACb;AAEO,IAAM,sBAAsB,CAAC,MAAsB;AACxD,SAAO,OAAO,gBAAgB,IAAI,GAAG,CAAC;AACxC;AAEO,IAAM,sBAAsB,CAAC,cAAsB,eAAuB;AAC/E,MAAI,eAAe,GAAG;AACpB,WAAO;AAAA,EACT;AACA,SAAQ,eAAe,aAAc;AACvC;AAEO,IAAM,WAAW,CAAC,OAAe,wBAAwB,MAAM;AACpE,QAAM,oBAAoB,KAAK,aAAa,SAAS;AAAA,IACnD,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO,KAAK;AACvC;","names":[]}
|