@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.
@@ -3,6 +3,7 @@ declare const Format: {
3
3
  address(data: any): string;
4
4
  match(value: any): string | any[];
5
5
  money: (value: any, notSign?: boolean) => string;
6
+ cssProperties: (styles: any) => any;
6
7
  };
7
8
 
8
9
  export { Format as default };
@@ -3,6 +3,7 @@ declare const Format: {
3
3
  address(data: any): string;
4
4
  match(value: any): string | any[];
5
5
  money: (value: any, notSign?: boolean) => string;
6
+ cssProperties: (styles: any) => any;
6
7
  };
7
8
 
8
9
  export { Format as default };
@@ -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;
@@ -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
@@ -7,6 +7,7 @@ declare class Utils {
7
7
  address(data: any): string;
8
8
  match(value: any): string | any[];
9
9
  money: (value: any, notSign?: boolean) => string;
10
+ cssProperties: (styles: any) => any;
10
11
  };
11
12
  static mask: {
12
13
  docNumber: (value: any) => any;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ declare class Utils {
7
7
  address(data: any): string;
8
8
  match(value: any): string | any[];
9
9
  money: (value: any, notSign?: boolean) => string;
10
+ cssProperties: (styles: any) => any;
10
11
  };
11
12
  static mask: {
12
13
  docNumber: (value: any) => any;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",