@gustavo-valsechi/utils 1.0.0

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/README.md ADDED
File without changes
@@ -0,0 +1,9 @@
1
+ declare const Format: {
2
+ stringLimit(value: string, limit: number): string;
3
+ address(data: any): string;
4
+ match(value: any): string | any[];
5
+ money: (value: any, notSign?: boolean) => string;
6
+ };
7
+ //# sourceMappingURL=index.d.ts.map
8
+
9
+ export { Format as default };
@@ -0,0 +1,9 @@
1
+ declare const Format: {
2
+ stringLimit(value: string, limit: number): string;
3
+ address(data: any): string;
4
+ match(value: any): string | any[];
5
+ money: (value: any, notSign?: boolean) => string;
6
+ };
7
+ //# sourceMappingURL=index.d.ts.map
8
+
9
+ export { Format as default };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/format/index.tsx
31
+ var format_exports = {};
32
+ __export(format_exports, {
33
+ default: () => format_default
34
+ });
35
+ module.exports = __toCommonJS(format_exports);
36
+ var import_lodash = __toESM(require("lodash"));
37
+ var Format = {
38
+ stringLimit(value, limit) {
39
+ if (!value) return "";
40
+ if (value.length <= limit) return value;
41
+ if (!import_lodash.default.isString(value)) return "";
42
+ return value.substring(0, limit) + "...";
43
+ },
44
+ address(data) {
45
+ if (!data) return "";
46
+ return `${data.city} - ${data.state} / ${data.address}`;
47
+ },
48
+ match(value) {
49
+ if (!value) return "";
50
+ if (Number(value.replace(/\D/g, ""))) return String(value);
51
+ if (typeof value !== "string") {
52
+ return import_lodash.default.map(value, (data) => data.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase());
53
+ }
54
+ return value.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase();
55
+ },
56
+ money: (value, notSign) => {
57
+ const locale = "pt-br";
58
+ value = parseFloat(value);
59
+ if (!notSign) {
60
+ return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
61
+ }
62
+ return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
63
+ }
64
+ };
65
+ var format_default = Format;
@@ -0,0 +1,34 @@
1
+ // src/format/index.tsx
2
+ import _ from "lodash";
3
+ var Format = {
4
+ stringLimit(value, limit) {
5
+ if (!value) return "";
6
+ if (value.length <= limit) return value;
7
+ if (!_.isString(value)) return "";
8
+ return value.substring(0, limit) + "...";
9
+ },
10
+ address(data) {
11
+ if (!data) return "";
12
+ return `${data.city} - ${data.state} / ${data.address}`;
13
+ },
14
+ match(value) {
15
+ if (!value) return "";
16
+ if (Number(value.replace(/\D/g, ""))) return String(value);
17
+ if (typeof value !== "string") {
18
+ return _.map(value, (data) => data.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase());
19
+ }
20
+ return value.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase();
21
+ },
22
+ money: (value, notSign) => {
23
+ const locale = "pt-br";
24
+ value = parseFloat(value);
25
+ if (!notSign) {
26
+ return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
27
+ }
28
+ return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
29
+ }
30
+ };
31
+ var format_default = Format;
32
+ export {
33
+ format_default as default
34
+ };
@@ -0,0 +1,34 @@
1
+ import * as moment from 'moment';
2
+
3
+ declare class Utils {
4
+ static moment: (inp?: moment.MomentInput, format?: moment.MomentFormatSpecification | undefined, language?: string | undefined, strict?: boolean | undefined) => moment.Moment;
5
+ static format: {
6
+ stringLimit(value: string, limit: number): string;
7
+ address(data: any): string;
8
+ match(value: any): string | any[];
9
+ money: (value: any, notSign?: boolean) => string;
10
+ };
11
+ static mask: {
12
+ docNumber: (value: any) => any;
13
+ phone: (value: any) => any;
14
+ kilo: (value: any) => any;
15
+ money(valor: any, nosign?: boolean, integer?: boolean): any;
16
+ number: (value: any) => any;
17
+ loop: (value: string | undefined, options: {
18
+ sequencyNumber: number;
19
+ maxSequency: number;
20
+ placeholder?: string;
21
+ separator?: string;
22
+ regex?: string;
23
+ }) => string;
24
+ };
25
+ static removeMask: {
26
+ phone: (value: any) => any;
27
+ docNumber: (value: any) => any;
28
+ percent: (value: any) => any;
29
+ money: (value: any) => any;
30
+ number: (value: any) => any;
31
+ };
32
+ }
33
+
34
+ export { Utils as default };
@@ -0,0 +1,34 @@
1
+ import * as moment from 'moment';
2
+
3
+ declare class Utils {
4
+ static moment: (inp?: moment.MomentInput, format?: moment.MomentFormatSpecification | undefined, language?: string | undefined, strict?: boolean | undefined) => moment.Moment;
5
+ static format: {
6
+ stringLimit(value: string, limit: number): string;
7
+ address(data: any): string;
8
+ match(value: any): string | any[];
9
+ money: (value: any, notSign?: boolean) => string;
10
+ };
11
+ static mask: {
12
+ docNumber: (value: any) => any;
13
+ phone: (value: any) => any;
14
+ kilo: (value: any) => any;
15
+ money(valor: any, nosign?: boolean, integer?: boolean): any;
16
+ number: (value: any) => any;
17
+ loop: (value: string | undefined, options: {
18
+ sequencyNumber: number;
19
+ maxSequency: number;
20
+ placeholder?: string;
21
+ separator?: string;
22
+ regex?: string;
23
+ }) => string;
24
+ };
25
+ static removeMask: {
26
+ phone: (value: any) => any;
27
+ docNumber: (value: any) => any;
28
+ percent: (value: any) => any;
29
+ money: (value: any) => any;
30
+ number: (value: any) => any;
31
+ };
32
+ }
33
+
34
+ export { Utils as default };
package/dist/index.js ADDED
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/moment/index.tsx
38
+ var import_moment_timezone = __toESM(require("moment-timezone"));
39
+ import_moment_timezone.default.tz(process.env.NEXT_PUBLIC_TIMEZONE || "");
40
+ var Moment = (...args) => {
41
+ return (0, import_moment_timezone.default)(...args);
42
+ };
43
+ var moment_default = Moment;
44
+
45
+ // src/format/index.tsx
46
+ var import_lodash = __toESM(require("lodash"));
47
+ var Format = {
48
+ stringLimit(value, limit) {
49
+ if (!value) return "";
50
+ if (value.length <= limit) return value;
51
+ if (!import_lodash.default.isString(value)) return "";
52
+ return value.substring(0, limit) + "...";
53
+ },
54
+ address(data) {
55
+ if (!data) return "";
56
+ return `${data.city} - ${data.state} / ${data.address}`;
57
+ },
58
+ match(value) {
59
+ if (!value) return "";
60
+ if (Number(value.replace(/\D/g, ""))) return String(value);
61
+ if (typeof value !== "string") {
62
+ return import_lodash.default.map(value, (data) => data.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase());
63
+ }
64
+ return value.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase();
65
+ },
66
+ money: (value, notSign) => {
67
+ const locale = "pt-br";
68
+ value = parseFloat(value);
69
+ if (!notSign) {
70
+ return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
71
+ }
72
+ return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
73
+ }
74
+ };
75
+ var format_default = Format;
76
+
77
+ // src/mask/index.tsx
78
+ var import_lodash2 = __toESM(require("lodash"));
79
+ var Mask = {
80
+ docNumber: (value) => {
81
+ if (!value) return "";
82
+ value = value.replace(/\D/g, "");
83
+ if (value.length <= 11) {
84
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
85
+ }
86
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1/$2").replace(/(\d{4})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
87
+ },
88
+ phone: (value) => {
89
+ if (!value) return "";
90
+ if (value.length === 14 || value.length === 10) {
91
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})(\d+?$)/, "$1");
92
+ }
93
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
94
+ },
95
+ kilo: (value) => {
96
+ if (!value) return "";
97
+ value = value.replace(/\D\./g, "");
98
+ if (import_lodash2.default.includes(value, ".")) {
99
+ const [left, right] = import_lodash2.default.split(value, ".");
100
+ value = `${import_lodash2.default.replace(left, /\D/g, "").substring(0, 3)}.${import_lodash2.default.replace(right, /\D/g, "").substring(0, 2)}`;
101
+ }
102
+ return value;
103
+ },
104
+ money(valor, nosign, integer) {
105
+ valor = valor + "";
106
+ valor = parseInt(valor.replace(/[\D]+/g, ""));
107
+ if (!nosign) valor = "R$ " + valor;
108
+ if (!integer) {
109
+ if (!nosign ? valor.length <= 4 : valor.length <= 1) {
110
+ valor = valor.replace(/([0-9]{1})$/g, "00$1");
111
+ }
112
+ if (!nosign ? valor.length <= 5 : valor.length <= 2) {
113
+ valor = valor.replace(/([0-9]{2})$/g, "0$1");
114
+ }
115
+ if (!nosign ? valor.length > 5 : valor.length > 2) {
116
+ valor = valor.replace(/([0-9]{2})$/g, ",$1");
117
+ }
118
+ if (!nosign ? valor.length > 9 : valor.length > 6) {
119
+ valor = valor.replace(/([0-9]{3}),([0-9]{2}$)/g, ".$1,$2");
120
+ }
121
+ if (!nosign ? valor.length > 13 : valor.length > 10) {
122
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2,$3");
123
+ }
124
+ if (!nosign ? valor.length > 17 : valor.length > 14) {
125
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2.$3,$4");
126
+ }
127
+ } else {
128
+ if (!nosign ? valor.length > 6 : valor.length > 3) {
129
+ valor = valor.replace(/([0-9]{3}$)/g, ".$1");
130
+ }
131
+ if (!nosign ? valor.length > 10 : valor.length > 7) {
132
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}$)/g, ".$1.$2");
133
+ }
134
+ if (!nosign ? valor.length > 14 : valor.length > 11) {
135
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}$)/g, ".$1.$2.$3");
136
+ }
137
+ }
138
+ if (valor === "R$ NaN") return "";
139
+ if (valor === "R$ 0,00") return "";
140
+ return valor.substring(0, 20);
141
+ },
142
+ number: (value) => {
143
+ if (!value) return "";
144
+ return value.replace(/\D/g, "");
145
+ },
146
+ loop: (value = "", options) => {
147
+ const {
148
+ sequencyNumber = 1,
149
+ maxSequency = 1,
150
+ placeholder = "",
151
+ separator = " ",
152
+ regex = `[^0-9${separator}]`
153
+ } = options || {};
154
+ const sequency = import_lodash2.default.repeat(placeholder, sequencyNumber);
155
+ const mask = import_lodash2.default.trim(import_lodash2.default.repeat(sequency + separator, maxSequency), separator);
156
+ const length = sequencyNumber * maxSequency;
157
+ const maxLength = separator ? length + (maxSequency - 1) : length;
158
+ const customRegex = new RegExp(regex, "g");
159
+ const sequencyRegex = new RegExp(`(.{${sequencyNumber}})`, "g");
160
+ const separatorRegex = new RegExp(separator, "g");
161
+ value = value.replace(customRegex, "");
162
+ value = value.replace(separatorRegex, "");
163
+ value = value.replace(sequencyRegex, "$1" + separator);
164
+ const placeholderMask = placeholder ? mask.substring(value.length, maxLength) : "";
165
+ return import_lodash2.default.trim(
166
+ (value + placeholderMask).substring(0, maxLength),
167
+ separator
168
+ );
169
+ }
170
+ };
171
+ var mask_default = Mask;
172
+
173
+ // src/remove-mask/index.tsx
174
+ var RemoveMask = {
175
+ phone: (value) => {
176
+ if (!value) return "";
177
+ return value.replace("(", "").replace(")", "").replace(" ", "").replace("-", "");
178
+ },
179
+ docNumber: (value) => {
180
+ if (!value) return "";
181
+ return value.replace(/\./g, "").replace("/", "").replace("-", "");
182
+ },
183
+ percent: (value) => {
184
+ if (!value) return "";
185
+ return value.replace(",", ".").replace("%", "");
186
+ },
187
+ money: (value) => {
188
+ if (!value) return "";
189
+ return value.replace("R$", "").replace(/\./g, "").replace(",", ".");
190
+ },
191
+ number: (value) => {
192
+ if (!value) return "";
193
+ return value.replace(/\D/g, "");
194
+ }
195
+ };
196
+ var remove_mask_default = RemoveMask;
197
+
198
+ // src/index.tsx
199
+ var Utils = class {
200
+ };
201
+ Utils.moment = moment_default;
202
+ Utils.format = format_default;
203
+ Utils.mask = mask_default;
204
+ Utils.removeMask = remove_mask_default;
205
+
206
+ // index.tsx
207
+ var index_default = Utils;
package/dist/index.mjs ADDED
@@ -0,0 +1,174 @@
1
+ // src/moment/index.tsx
2
+ import moment from "moment-timezone";
3
+ moment.tz(process.env.NEXT_PUBLIC_TIMEZONE || "");
4
+ var Moment = (...args) => {
5
+ return moment(...args);
6
+ };
7
+ var moment_default = Moment;
8
+
9
+ // src/format/index.tsx
10
+ import _ from "lodash";
11
+ var Format = {
12
+ stringLimit(value, limit) {
13
+ if (!value) return "";
14
+ if (value.length <= limit) return value;
15
+ if (!_.isString(value)) return "";
16
+ return value.substring(0, limit) + "...";
17
+ },
18
+ address(data) {
19
+ if (!data) return "";
20
+ return `${data.city} - ${data.state} / ${data.address}`;
21
+ },
22
+ match(value) {
23
+ if (!value) return "";
24
+ if (Number(value.replace(/\D/g, ""))) return String(value);
25
+ if (typeof value !== "string") {
26
+ return _.map(value, (data) => data.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase());
27
+ }
28
+ return value.normalize("NFD").replace(/[^a-zA-Z\s]/g, "").toUpperCase();
29
+ },
30
+ money: (value, notSign) => {
31
+ const locale = "pt-br";
32
+ value = parseFloat(value);
33
+ if (!notSign) {
34
+ return new Intl.NumberFormat(locale, { style: "currency", currency: "BRL" }).format(value);
35
+ }
36
+ return new Intl.NumberFormat(locale, { minimumFractionDigits: 2 }).format(value);
37
+ }
38
+ };
39
+ var format_default = Format;
40
+
41
+ // src/mask/index.tsx
42
+ import _2 from "lodash";
43
+ var Mask = {
44
+ docNumber: (value) => {
45
+ if (!value) return "";
46
+ value = value.replace(/\D/g, "");
47
+ if (value.length <= 11) {
48
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
49
+ }
50
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1/$2").replace(/(\d{4})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
51
+ },
52
+ phone: (value) => {
53
+ if (!value) return "";
54
+ if (value.length === 14 || value.length === 10) {
55
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})(\d+?$)/, "$1");
56
+ }
57
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
58
+ },
59
+ kilo: (value) => {
60
+ if (!value) return "";
61
+ value = value.replace(/\D\./g, "");
62
+ if (_2.includes(value, ".")) {
63
+ const [left, right] = _2.split(value, ".");
64
+ value = `${_2.replace(left, /\D/g, "").substring(0, 3)}.${_2.replace(right, /\D/g, "").substring(0, 2)}`;
65
+ }
66
+ return value;
67
+ },
68
+ money(valor, nosign, integer) {
69
+ valor = valor + "";
70
+ valor = parseInt(valor.replace(/[\D]+/g, ""));
71
+ if (!nosign) valor = "R$ " + valor;
72
+ if (!integer) {
73
+ if (!nosign ? valor.length <= 4 : valor.length <= 1) {
74
+ valor = valor.replace(/([0-9]{1})$/g, "00$1");
75
+ }
76
+ if (!nosign ? valor.length <= 5 : valor.length <= 2) {
77
+ valor = valor.replace(/([0-9]{2})$/g, "0$1");
78
+ }
79
+ if (!nosign ? valor.length > 5 : valor.length > 2) {
80
+ valor = valor.replace(/([0-9]{2})$/g, ",$1");
81
+ }
82
+ if (!nosign ? valor.length > 9 : valor.length > 6) {
83
+ valor = valor.replace(/([0-9]{3}),([0-9]{2}$)/g, ".$1,$2");
84
+ }
85
+ if (!nosign ? valor.length > 13 : valor.length > 10) {
86
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2,$3");
87
+ }
88
+ if (!nosign ? valor.length > 17 : valor.length > 14) {
89
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2.$3,$4");
90
+ }
91
+ } else {
92
+ if (!nosign ? valor.length > 6 : valor.length > 3) {
93
+ valor = valor.replace(/([0-9]{3}$)/g, ".$1");
94
+ }
95
+ if (!nosign ? valor.length > 10 : valor.length > 7) {
96
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}$)/g, ".$1.$2");
97
+ }
98
+ if (!nosign ? valor.length > 14 : valor.length > 11) {
99
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}$)/g, ".$1.$2.$3");
100
+ }
101
+ }
102
+ if (valor === "R$ NaN") return "";
103
+ if (valor === "R$ 0,00") return "";
104
+ return valor.substring(0, 20);
105
+ },
106
+ number: (value) => {
107
+ if (!value) return "";
108
+ return value.replace(/\D/g, "");
109
+ },
110
+ loop: (value = "", options) => {
111
+ const {
112
+ sequencyNumber = 1,
113
+ maxSequency = 1,
114
+ placeholder = "",
115
+ separator = " ",
116
+ regex = `[^0-9${separator}]`
117
+ } = options || {};
118
+ const sequency = _2.repeat(placeholder, sequencyNumber);
119
+ const mask = _2.trim(_2.repeat(sequency + separator, maxSequency), separator);
120
+ const length = sequencyNumber * maxSequency;
121
+ const maxLength = separator ? length + (maxSequency - 1) : length;
122
+ const customRegex = new RegExp(regex, "g");
123
+ const sequencyRegex = new RegExp(`(.{${sequencyNumber}})`, "g");
124
+ const separatorRegex = new RegExp(separator, "g");
125
+ value = value.replace(customRegex, "");
126
+ value = value.replace(separatorRegex, "");
127
+ value = value.replace(sequencyRegex, "$1" + separator);
128
+ const placeholderMask = placeholder ? mask.substring(value.length, maxLength) : "";
129
+ return _2.trim(
130
+ (value + placeholderMask).substring(0, maxLength),
131
+ separator
132
+ );
133
+ }
134
+ };
135
+ var mask_default = Mask;
136
+
137
+ // src/remove-mask/index.tsx
138
+ var RemoveMask = {
139
+ phone: (value) => {
140
+ if (!value) return "";
141
+ return value.replace("(", "").replace(")", "").replace(" ", "").replace("-", "");
142
+ },
143
+ docNumber: (value) => {
144
+ if (!value) return "";
145
+ return value.replace(/\./g, "").replace("/", "").replace("-", "");
146
+ },
147
+ percent: (value) => {
148
+ if (!value) return "";
149
+ return value.replace(",", ".").replace("%", "");
150
+ },
151
+ money: (value) => {
152
+ if (!value) return "";
153
+ return value.replace("R$", "").replace(/\./g, "").replace(",", ".");
154
+ },
155
+ number: (value) => {
156
+ if (!value) return "";
157
+ return value.replace(/\D/g, "");
158
+ }
159
+ };
160
+ var remove_mask_default = RemoveMask;
161
+
162
+ // src/index.tsx
163
+ var Utils = class {
164
+ };
165
+ Utils.moment = moment_default;
166
+ Utils.format = format_default;
167
+ Utils.mask = mask_default;
168
+ Utils.removeMask = remove_mask_default;
169
+
170
+ // index.tsx
171
+ var index_default = Utils;
172
+ export {
173
+ index_default as default
174
+ };
@@ -0,0 +1,17 @@
1
+ declare const Mask: {
2
+ docNumber: (value: any) => any;
3
+ phone: (value: any) => any;
4
+ kilo: (value: any) => any;
5
+ money(valor: any, nosign?: boolean, integer?: boolean): any;
6
+ number: (value: any) => any;
7
+ loop: (value: string | undefined, options: {
8
+ sequencyNumber: number;
9
+ maxSequency: number;
10
+ placeholder?: string;
11
+ separator?: string;
12
+ regex?: string;
13
+ }) => string;
14
+ };
15
+ //# sourceMappingURL=index.d.ts.map
16
+
17
+ export { Mask as default };
@@ -0,0 +1,17 @@
1
+ declare const Mask: {
2
+ docNumber: (value: any) => any;
3
+ phone: (value: any) => any;
4
+ kilo: (value: any) => any;
5
+ money(valor: any, nosign?: boolean, integer?: boolean): any;
6
+ number: (value: any) => any;
7
+ loop: (value: string | undefined, options: {
8
+ sequencyNumber: number;
9
+ maxSequency: number;
10
+ placeholder?: string;
11
+ separator?: string;
12
+ regex?: string;
13
+ }) => string;
14
+ };
15
+ //# sourceMappingURL=index.d.ts.map
16
+
17
+ export { Mask as default };
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/mask/index.tsx
31
+ var mask_exports = {};
32
+ __export(mask_exports, {
33
+ default: () => mask_default
34
+ });
35
+ module.exports = __toCommonJS(mask_exports);
36
+ var import_lodash = __toESM(require("lodash"));
37
+ var Mask = {
38
+ docNumber: (value) => {
39
+ if (!value) return "";
40
+ value = value.replace(/\D/g, "");
41
+ if (value.length <= 11) {
42
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
43
+ }
44
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1/$2").replace(/(\d{4})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
45
+ },
46
+ phone: (value) => {
47
+ if (!value) return "";
48
+ if (value.length === 14 || value.length === 10) {
49
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})(\d+?$)/, "$1");
50
+ }
51
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
52
+ },
53
+ kilo: (value) => {
54
+ if (!value) return "";
55
+ value = value.replace(/\D\./g, "");
56
+ if (import_lodash.default.includes(value, ".")) {
57
+ const [left, right] = import_lodash.default.split(value, ".");
58
+ value = `${import_lodash.default.replace(left, /\D/g, "").substring(0, 3)}.${import_lodash.default.replace(right, /\D/g, "").substring(0, 2)}`;
59
+ }
60
+ return value;
61
+ },
62
+ money(valor, nosign, integer) {
63
+ valor = valor + "";
64
+ valor = parseInt(valor.replace(/[\D]+/g, ""));
65
+ if (!nosign) valor = "R$ " + valor;
66
+ if (!integer) {
67
+ if (!nosign ? valor.length <= 4 : valor.length <= 1) {
68
+ valor = valor.replace(/([0-9]{1})$/g, "00$1");
69
+ }
70
+ if (!nosign ? valor.length <= 5 : valor.length <= 2) {
71
+ valor = valor.replace(/([0-9]{2})$/g, "0$1");
72
+ }
73
+ if (!nosign ? valor.length > 5 : valor.length > 2) {
74
+ valor = valor.replace(/([0-9]{2})$/g, ",$1");
75
+ }
76
+ if (!nosign ? valor.length > 9 : valor.length > 6) {
77
+ valor = valor.replace(/([0-9]{3}),([0-9]{2}$)/g, ".$1,$2");
78
+ }
79
+ if (!nosign ? valor.length > 13 : valor.length > 10) {
80
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2,$3");
81
+ }
82
+ if (!nosign ? valor.length > 17 : valor.length > 14) {
83
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2.$3,$4");
84
+ }
85
+ } else {
86
+ if (!nosign ? valor.length > 6 : valor.length > 3) {
87
+ valor = valor.replace(/([0-9]{3}$)/g, ".$1");
88
+ }
89
+ if (!nosign ? valor.length > 10 : valor.length > 7) {
90
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}$)/g, ".$1.$2");
91
+ }
92
+ if (!nosign ? valor.length > 14 : valor.length > 11) {
93
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}$)/g, ".$1.$2.$3");
94
+ }
95
+ }
96
+ if (valor === "R$ NaN") return "";
97
+ if (valor === "R$ 0,00") return "";
98
+ return valor.substring(0, 20);
99
+ },
100
+ number: (value) => {
101
+ if (!value) return "";
102
+ return value.replace(/\D/g, "");
103
+ },
104
+ loop: (value = "", options) => {
105
+ const {
106
+ sequencyNumber = 1,
107
+ maxSequency = 1,
108
+ placeholder = "",
109
+ separator = " ",
110
+ regex = `[^0-9${separator}]`
111
+ } = options || {};
112
+ const sequency = import_lodash.default.repeat(placeholder, sequencyNumber);
113
+ const mask = import_lodash.default.trim(import_lodash.default.repeat(sequency + separator, maxSequency), separator);
114
+ const length = sequencyNumber * maxSequency;
115
+ const maxLength = separator ? length + (maxSequency - 1) : length;
116
+ const customRegex = new RegExp(regex, "g");
117
+ const sequencyRegex = new RegExp(`(.{${sequencyNumber}})`, "g");
118
+ const separatorRegex = new RegExp(separator, "g");
119
+ value = value.replace(customRegex, "");
120
+ value = value.replace(separatorRegex, "");
121
+ value = value.replace(sequencyRegex, "$1" + separator);
122
+ const placeholderMask = placeholder ? mask.substring(value.length, maxLength) : "";
123
+ return import_lodash.default.trim(
124
+ (value + placeholderMask).substring(0, maxLength),
125
+ separator
126
+ );
127
+ }
128
+ };
129
+ var mask_default = Mask;
@@ -0,0 +1,98 @@
1
+ // src/mask/index.tsx
2
+ import _ from "lodash";
3
+ var Mask = {
4
+ docNumber: (value) => {
5
+ if (!value) return "";
6
+ value = value.replace(/\D/g, "");
7
+ if (value.length <= 11) {
8
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
9
+ }
10
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1/$2").replace(/(\d{4})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
11
+ },
12
+ phone: (value) => {
13
+ if (!value) return "";
14
+ if (value.length === 14 || value.length === 10) {
15
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})(\d+?$)/, "$1");
16
+ }
17
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
18
+ },
19
+ kilo: (value) => {
20
+ if (!value) return "";
21
+ value = value.replace(/\D\./g, "");
22
+ if (_.includes(value, ".")) {
23
+ const [left, right] = _.split(value, ".");
24
+ value = `${_.replace(left, /\D/g, "").substring(0, 3)}.${_.replace(right, /\D/g, "").substring(0, 2)}`;
25
+ }
26
+ return value;
27
+ },
28
+ money(valor, nosign, integer) {
29
+ valor = valor + "";
30
+ valor = parseInt(valor.replace(/[\D]+/g, ""));
31
+ if (!nosign) valor = "R$ " + valor;
32
+ if (!integer) {
33
+ if (!nosign ? valor.length <= 4 : valor.length <= 1) {
34
+ valor = valor.replace(/([0-9]{1})$/g, "00$1");
35
+ }
36
+ if (!nosign ? valor.length <= 5 : valor.length <= 2) {
37
+ valor = valor.replace(/([0-9]{2})$/g, "0$1");
38
+ }
39
+ if (!nosign ? valor.length > 5 : valor.length > 2) {
40
+ valor = valor.replace(/([0-9]{2})$/g, ",$1");
41
+ }
42
+ if (!nosign ? valor.length > 9 : valor.length > 6) {
43
+ valor = valor.replace(/([0-9]{3}),([0-9]{2}$)/g, ".$1,$2");
44
+ }
45
+ if (!nosign ? valor.length > 13 : valor.length > 10) {
46
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2,$3");
47
+ }
48
+ if (!nosign ? valor.length > 17 : valor.length > 14) {
49
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}),([0-9]{2}$)/g, ".$1.$2.$3,$4");
50
+ }
51
+ } else {
52
+ if (!nosign ? valor.length > 6 : valor.length > 3) {
53
+ valor = valor.replace(/([0-9]{3}$)/g, ".$1");
54
+ }
55
+ if (!nosign ? valor.length > 10 : valor.length > 7) {
56
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}$)/g, ".$1.$2");
57
+ }
58
+ if (!nosign ? valor.length > 14 : valor.length > 11) {
59
+ valor = valor.replace(/([0-9]{3}).([0-9]{3}).([0-9]{3}$)/g, ".$1.$2.$3");
60
+ }
61
+ }
62
+ if (valor === "R$ NaN") return "";
63
+ if (valor === "R$ 0,00") return "";
64
+ return valor.substring(0, 20);
65
+ },
66
+ number: (value) => {
67
+ if (!value) return "";
68
+ return value.replace(/\D/g, "");
69
+ },
70
+ loop: (value = "", options) => {
71
+ const {
72
+ sequencyNumber = 1,
73
+ maxSequency = 1,
74
+ placeholder = "",
75
+ separator = " ",
76
+ regex = `[^0-9${separator}]`
77
+ } = options || {};
78
+ const sequency = _.repeat(placeholder, sequencyNumber);
79
+ const mask = _.trim(_.repeat(sequency + separator, maxSequency), separator);
80
+ const length = sequencyNumber * maxSequency;
81
+ const maxLength = separator ? length + (maxSequency - 1) : length;
82
+ const customRegex = new RegExp(regex, "g");
83
+ const sequencyRegex = new RegExp(`(.{${sequencyNumber}})`, "g");
84
+ const separatorRegex = new RegExp(separator, "g");
85
+ value = value.replace(customRegex, "");
86
+ value = value.replace(separatorRegex, "");
87
+ value = value.replace(sequencyRegex, "$1" + separator);
88
+ const placeholderMask = placeholder ? mask.substring(value.length, maxLength) : "";
89
+ return _.trim(
90
+ (value + placeholderMask).substring(0, maxLength),
91
+ separator
92
+ );
93
+ }
94
+ };
95
+ var mask_default = Mask;
96
+ export {
97
+ mask_default as default
98
+ };
@@ -0,0 +1,6 @@
1
+ import moment from 'moment-timezone';
2
+
3
+ declare const Moment: (inp?: moment.MomentInput, format?: moment.MomentFormatSpecification | undefined, language?: string | undefined, strict?: boolean | undefined) => moment.Moment;
4
+ //# sourceMappingURL=index.d.ts.map
5
+
6
+ export { Moment as default };
@@ -0,0 +1,6 @@
1
+ import moment from 'moment-timezone';
2
+
3
+ declare const Moment: (inp?: moment.MomentInput, format?: moment.MomentFormatSpecification | undefined, language?: string | undefined, strict?: boolean | undefined) => moment.Moment;
4
+ //# sourceMappingURL=index.d.ts.map
5
+
6
+ export { Moment as default };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/moment/index.tsx
31
+ var moment_exports = {};
32
+ __export(moment_exports, {
33
+ default: () => moment_default
34
+ });
35
+ module.exports = __toCommonJS(moment_exports);
36
+ var import_moment_timezone = __toESM(require("moment-timezone"));
37
+ import_moment_timezone.default.tz(process.env.NEXT_PUBLIC_TIMEZONE || "");
38
+ var Moment = (...args) => {
39
+ return (0, import_moment_timezone.default)(...args);
40
+ };
41
+ var moment_default = Moment;
@@ -0,0 +1,10 @@
1
+ // src/moment/index.tsx
2
+ import moment from "moment-timezone";
3
+ moment.tz(process.env.NEXT_PUBLIC_TIMEZONE || "");
4
+ var Moment = (...args) => {
5
+ return moment(...args);
6
+ };
7
+ var moment_default = Moment;
8
+ export {
9
+ moment_default as default
10
+ };
@@ -0,0 +1,10 @@
1
+ declare const RemoveMask: {
2
+ phone: (value: any) => any;
3
+ docNumber: (value: any) => any;
4
+ percent: (value: any) => any;
5
+ money: (value: any) => any;
6
+ number: (value: any) => any;
7
+ };
8
+ //# sourceMappingURL=index.d.ts.map
9
+
10
+ export { RemoveMask as default };
@@ -0,0 +1,10 @@
1
+ declare const RemoveMask: {
2
+ phone: (value: any) => any;
3
+ docNumber: (value: any) => any;
4
+ percent: (value: any) => any;
5
+ money: (value: any) => any;
6
+ number: (value: any) => any;
7
+ };
8
+ //# sourceMappingURL=index.d.ts.map
9
+
10
+ export { RemoveMask as default };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/remove-mask/index.tsx
21
+ var remove_mask_exports = {};
22
+ __export(remove_mask_exports, {
23
+ default: () => remove_mask_default
24
+ });
25
+ module.exports = __toCommonJS(remove_mask_exports);
26
+ var RemoveMask = {
27
+ phone: (value) => {
28
+ if (!value) return "";
29
+ return value.replace("(", "").replace(")", "").replace(" ", "").replace("-", "");
30
+ },
31
+ docNumber: (value) => {
32
+ if (!value) return "";
33
+ return value.replace(/\./g, "").replace("/", "").replace("-", "");
34
+ },
35
+ percent: (value) => {
36
+ if (!value) return "";
37
+ return value.replace(",", ".").replace("%", "");
38
+ },
39
+ money: (value) => {
40
+ if (!value) return "";
41
+ return value.replace("R$", "").replace(/\./g, "").replace(",", ".");
42
+ },
43
+ number: (value) => {
44
+ if (!value) return "";
45
+ return value.replace(/\D/g, "");
46
+ }
47
+ };
48
+ var remove_mask_default = RemoveMask;
@@ -0,0 +1,27 @@
1
+ // src/remove-mask/index.tsx
2
+ var RemoveMask = {
3
+ phone: (value) => {
4
+ if (!value) return "";
5
+ return value.replace("(", "").replace(")", "").replace(" ", "").replace("-", "");
6
+ },
7
+ docNumber: (value) => {
8
+ if (!value) return "";
9
+ return value.replace(/\./g, "").replace("/", "").replace("-", "");
10
+ },
11
+ percent: (value) => {
12
+ if (!value) return "";
13
+ return value.replace(",", ".").replace("%", "");
14
+ },
15
+ money: (value) => {
16
+ if (!value) return "";
17
+ return value.replace("R$", "").replace(/\./g, "").replace(",", ".");
18
+ },
19
+ number: (value) => {
20
+ if (!value) return "";
21
+ return value.replace(/\D/g, "");
22
+ }
23
+ };
24
+ var remove_mask_default = RemoveMask;
25
+ export {
26
+ remove_mask_default as default
27
+ };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@gustavo-valsechi/utils",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "license": "UNLICENSED",
11
+ "scripts": {
12
+ "clean": "rimraf dist && rimraf node_modules/.cache",
13
+ "build:js": "tsup && tsc-alias",
14
+ "build:remodel": "node scripts/remodel.js",
15
+ "build": "npm run clean && npm run build:js && npm run build:remodel",
16
+ "commit": "npm run build && npm publish --access public"
17
+ },
18
+ "dependencies": {
19
+ "lodash": "4.17.21",
20
+ "moment": "2.30.1",
21
+ "moment-timezone": "0.6.0",
22
+ "tsup": "8.5.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/lodash": "4.17.7",
26
+ "@types/node": "22.0.2",
27
+ "esbuild": "0.25.11",
28
+ "rimraf": "6.1.0",
29
+ "tsc-alias": "1.8.16",
30
+ "typescript": "5.5.4"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "require": "./dist/index.js",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./mask": {
42
+ "types": "./dist/mask/index.d.ts",
43
+ "require": "./dist/mask/index.js",
44
+ "import": "./dist/mask/index.js"
45
+ },
46
+ "./remove-mask": {
47
+ "types": "./dist/remove-mask/index.d.ts",
48
+ "require": "./dist/remove-mask/index.js",
49
+ "import": "./dist/remove-mask/index.js"
50
+ },
51
+ "./format": {
52
+ "types": "./dist/format/index.d.ts",
53
+ "require": "./dist/format/index.js",
54
+ "import": "./dist/format/index.js"
55
+ },
56
+ "./moment": {
57
+ "types": "./dist/moment/index.d.ts",
58
+ "require": "./dist/moment/index.js",
59
+ "import": "./dist/moment/index.js"
60
+ }
61
+ }
62
+ }