@gustavo-valsechi/utils 1.0.3 → 1.0.4
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/format/index.d.mts +1 -0
- package/dist/format/index.d.ts +1 -0
- package/dist/format/index.js +12 -0
- package/dist/format/index.mjs +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/dist/index.mjs +12 -0
- package/package.json +1 -1
package/dist/format/index.d.mts
CHANGED
package/dist/format/index.d.ts
CHANGED
package/dist/format/index.js
CHANGED
|
@@ -60,6 +60,18 @@ var Format = {
|
|
|
60
60
|
return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
|
|
61
61
|
}
|
|
62
62
|
return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
|
|
63
|
+
},
|
|
64
|
+
cssProperties: (styles) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
if (!styles) return {};
|
|
67
|
+
if (styles == null ? void 0 : styles.componentStyle) styles = ((_b = (_a = styles == null ? void 0 : styles.componentStyle) == null ? void 0 : _a.rules) == null ? void 0 : _b.join("\n")) || "";
|
|
68
|
+
const style = {};
|
|
69
|
+
styles.split(";").forEach((rule) => {
|
|
70
|
+
const [property, value] = rule.split(":").map((p) => p == null ? void 0 : p.trim());
|
|
71
|
+
if (!property || !value) return;
|
|
72
|
+
style[import_lodash.default.camelCase(property)] = value;
|
|
73
|
+
});
|
|
74
|
+
return style;
|
|
63
75
|
}
|
|
64
76
|
};
|
|
65
77
|
var format_default = Format;
|
package/dist/format/index.mjs
CHANGED
|
@@ -26,6 +26,18 @@ var Format = {
|
|
|
26
26
|
return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
|
|
27
27
|
}
|
|
28
28
|
return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
|
|
29
|
+
},
|
|
30
|
+
cssProperties: (styles) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (!styles) return {};
|
|
33
|
+
if (styles == null ? void 0 : styles.componentStyle) styles = ((_b = (_a = styles == null ? void 0 : styles.componentStyle) == null ? void 0 : _a.rules) == null ? void 0 : _b.join("\n")) || "";
|
|
34
|
+
const style = {};
|
|
35
|
+
styles.split(";").forEach((rule) => {
|
|
36
|
+
const [property, value] = rule.split(":").map((p) => p == null ? void 0 : p.trim());
|
|
37
|
+
if (!property || !value) return;
|
|
38
|
+
style[_.camelCase(property)] = value;
|
|
39
|
+
});
|
|
40
|
+
return style;
|
|
29
41
|
}
|
|
30
42
|
};
|
|
31
43
|
var format_default = Format;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -70,6 +70,18 @@ var Format = {
|
|
|
70
70
|
return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
|
|
71
71
|
}
|
|
72
72
|
return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
|
|
73
|
+
},
|
|
74
|
+
cssProperties: (styles) => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
if (!styles) return {};
|
|
77
|
+
if (styles == null ? void 0 : styles.componentStyle) styles = ((_b = (_a = styles == null ? void 0 : styles.componentStyle) == null ? void 0 : _a.rules) == null ? void 0 : _b.join("\n")) || "";
|
|
78
|
+
const style = {};
|
|
79
|
+
styles.split(";").forEach((rule) => {
|
|
80
|
+
const [property, value] = rule.split(":").map((p) => p == null ? void 0 : p.trim());
|
|
81
|
+
if (!property || !value) return;
|
|
82
|
+
style[import_lodash.default.camelCase(property)] = value;
|
|
83
|
+
});
|
|
84
|
+
return style;
|
|
73
85
|
}
|
|
74
86
|
};
|
|
75
87
|
var format_default = Format;
|
package/dist/index.mjs
CHANGED
|
@@ -34,6 +34,18 @@ var Format = {
|
|
|
34
34
|
return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
|
|
35
35
|
}
|
|
36
36
|
return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
|
|
37
|
+
},
|
|
38
|
+
cssProperties: (styles) => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
if (!styles) return {};
|
|
41
|
+
if (styles == null ? void 0 : styles.componentStyle) styles = ((_b = (_a = styles == null ? void 0 : styles.componentStyle) == null ? void 0 : _a.rules) == null ? void 0 : _b.join("\n")) || "";
|
|
42
|
+
const style = {};
|
|
43
|
+
styles.split(";").forEach((rule) => {
|
|
44
|
+
const [property, value] = rule.split(":").map((p) => p == null ? void 0 : p.trim());
|
|
45
|
+
if (!property || !value) return;
|
|
46
|
+
style[_.camelCase(property)] = value;
|
|
47
|
+
});
|
|
48
|
+
return style;
|
|
37
49
|
}
|
|
38
50
|
};
|
|
39
51
|
var format_default = Format;
|