@gustavo-valsechi/utils 1.0.3 → 1.0.5
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 +10 -0
- package/dist/format/index.mjs +10 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -0
- package/dist/index.mjs +10 -0
- package/package.json +5 -1
package/dist/format/index.d.mts
CHANGED
package/dist/format/index.d.ts
CHANGED
package/dist/format/index.js
CHANGED
|
@@ -60,6 +60,16 @@ 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
|
+
textIntoElement: (element) => {
|
|
65
|
+
var _a;
|
|
66
|
+
if (typeof element === "string" || typeof element === "number") return String(element);
|
|
67
|
+
if (import_lodash.default.isArray(element)) return element.map(Format.textIntoElement).join("");
|
|
68
|
+
if (element && typeof element === "object" && "props" in element) {
|
|
69
|
+
return Format.textIntoElement((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children);
|
|
70
|
+
}
|
|
71
|
+
if (element == null ? void 0 : element.textContent) return element == null ? void 0 : element.textContent;
|
|
72
|
+
return "";
|
|
63
73
|
}
|
|
64
74
|
};
|
|
65
75
|
var format_default = Format;
|
package/dist/format/index.mjs
CHANGED
|
@@ -26,6 +26,16 @@ 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
|
+
textIntoElement: (element) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (typeof element === "string" || typeof element === "number") return String(element);
|
|
33
|
+
if (_.isArray(element)) return element.map(Format.textIntoElement).join("");
|
|
34
|
+
if (element && typeof element === "object" && "props" in element) {
|
|
35
|
+
return Format.textIntoElement((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children);
|
|
36
|
+
}
|
|
37
|
+
if (element == null ? void 0 : element.textContent) return element == null ? void 0 : element.textContent;
|
|
38
|
+
return "";
|
|
29
39
|
}
|
|
30
40
|
};
|
|
31
41
|
var format_default = Format;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -70,6 +70,16 @@ 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
|
+
textIntoElement: (element) => {
|
|
75
|
+
var _a;
|
|
76
|
+
if (typeof element === "string" || typeof element === "number") return String(element);
|
|
77
|
+
if (import_lodash.default.isArray(element)) return element.map(Format.textIntoElement).join("");
|
|
78
|
+
if (element && typeof element === "object" && "props" in element) {
|
|
79
|
+
return Format.textIntoElement((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children);
|
|
80
|
+
}
|
|
81
|
+
if (element == null ? void 0 : element.textContent) return element == null ? void 0 : element.textContent;
|
|
82
|
+
return "";
|
|
73
83
|
}
|
|
74
84
|
};
|
|
75
85
|
var format_default = Format;
|
package/dist/index.mjs
CHANGED
|
@@ -34,6 +34,16 @@ 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
|
+
textIntoElement: (element) => {
|
|
39
|
+
var _a;
|
|
40
|
+
if (typeof element === "string" || typeof element === "number") return String(element);
|
|
41
|
+
if (_.isArray(element)) return element.map(Format.textIntoElement).join("");
|
|
42
|
+
if (element && typeof element === "object" && "props" in element) {
|
|
43
|
+
return Format.textIntoElement((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children);
|
|
44
|
+
}
|
|
45
|
+
if (element == null ? void 0 : element.textContent) return element == null ? void 0 : element.textContent;
|
|
46
|
+
return "";
|
|
37
47
|
}
|
|
38
48
|
};
|
|
39
49
|
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
|
+
"version": "1.0.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"build": "npm run clean && npm run build:js && npm run build:remodel",
|
|
16
16
|
"commit": "npm run build && npm version patch --no-git-tag-version && npm publish --access public"
|
|
17
17
|
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": "19.2.0"
|
|
20
|
+
},
|
|
18
21
|
"dependencies": {
|
|
19
22
|
"lodash": "4.17.21",
|
|
20
23
|
"moment": "2.30.1",
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
"@types/lodash": "4.17.7",
|
|
26
29
|
"@types/node": "22.0.2",
|
|
27
30
|
"esbuild": "0.25.11",
|
|
31
|
+
"react": "19.2.0",
|
|
28
32
|
"rimraf": "6.1.0",
|
|
29
33
|
"tsc-alias": "1.8.16",
|
|
30
34
|
"typescript": "5.5.4"
|