@gustavo-valsechi/utils 1.0.2 → 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/default/index.d.mts +13 -5
- package/dist/default/index.d.ts +13 -5
- package/dist/default/index.js +9 -37
- package/dist/default/index.mjs +9 -27
- 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 +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +21 -27
- package/dist/index.mjs +21 -27
- package/package.json +1 -1
package/dist/default/index.d.mts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
type DefaultValue<T> = {
|
|
2
|
-
[K in keyof T]: T[K] extends string ? '' : T[K] extends number ? 0 : T[K] extends boolean ? false : T[K] extends Array<infer U> ? DefaultValue<U>[] : T[K] extends object ? DefaultValue<T[K]> : null;
|
|
3
|
-
};
|
|
4
1
|
declare const Default: {
|
|
5
|
-
|
|
2
|
+
credentials: {
|
|
3
|
+
page: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
order: {
|
|
6
|
+
createdAt: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
pagination: {
|
|
10
|
+
content: never[];
|
|
11
|
+
total: number;
|
|
12
|
+
totalPage: number;
|
|
13
|
+
};
|
|
6
14
|
};
|
|
7
15
|
|
|
8
|
-
export {
|
|
16
|
+
export { Default as default };
|
package/dist/default/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
type DefaultValue<T> = {
|
|
2
|
-
[K in keyof T]: T[K] extends string ? '' : T[K] extends number ? 0 : T[K] extends boolean ? false : T[K] extends Array<infer U> ? DefaultValue<U>[] : T[K] extends object ? DefaultValue<T[K]> : null;
|
|
3
|
-
};
|
|
4
1
|
declare const Default: {
|
|
5
|
-
|
|
2
|
+
credentials: {
|
|
3
|
+
page: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
order: {
|
|
6
|
+
createdAt: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
pagination: {
|
|
10
|
+
content: never[];
|
|
11
|
+
total: number;
|
|
12
|
+
totalPage: number;
|
|
13
|
+
};
|
|
6
14
|
};
|
|
7
15
|
|
|
8
|
-
export {
|
|
16
|
+
export { Default as default };
|
package/dist/default/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
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
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/default/index.ts
|
|
@@ -33,34 +23,16 @@ __export(default_exports, {
|
|
|
33
23
|
default: () => default_default
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(default_exports);
|
|
36
|
-
var import_lodash = __toESM(require("lodash"));
|
|
37
26
|
var Default = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
result[key] = 0;
|
|
48
|
-
break;
|
|
49
|
-
case "boolean":
|
|
50
|
-
result[key] = "";
|
|
51
|
-
break;
|
|
52
|
-
case "object":
|
|
53
|
-
if (import_lodash.default.isArray(value)) {
|
|
54
|
-
result[key] = [];
|
|
55
|
-
} else if (value !== null) {
|
|
56
|
-
result[key] = Default.build(value);
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
default:
|
|
60
|
-
result[key] = null;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
27
|
+
credentials: {
|
|
28
|
+
page: 1,
|
|
29
|
+
limit: 10,
|
|
30
|
+
order: { createdAt: "desc" }
|
|
31
|
+
},
|
|
32
|
+
pagination: {
|
|
33
|
+
content: [],
|
|
34
|
+
total: 0,
|
|
35
|
+
totalPage: 0
|
|
64
36
|
}
|
|
65
37
|
};
|
|
66
38
|
var default_default = Default;
|
package/dist/default/index.mjs
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
// src/default/index.ts
|
|
2
|
-
import _ from "lodash";
|
|
3
2
|
var Default = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
result[key] = 0;
|
|
14
|
-
break;
|
|
15
|
-
case "boolean":
|
|
16
|
-
result[key] = "";
|
|
17
|
-
break;
|
|
18
|
-
case "object":
|
|
19
|
-
if (_.isArray(value)) {
|
|
20
|
-
result[key] = [];
|
|
21
|
-
} else if (value !== null) {
|
|
22
|
-
result[key] = Default.build(value);
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
default:
|
|
26
|
-
result[key] = null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
3
|
+
credentials: {
|
|
4
|
+
page: 1,
|
|
5
|
+
limit: 10,
|
|
6
|
+
order: { createdAt: "desc" }
|
|
7
|
+
},
|
|
8
|
+
pagination: {
|
|
9
|
+
content: [],
|
|
10
|
+
total: 0,
|
|
11
|
+
totalPage: 0
|
|
30
12
|
}
|
|
31
13
|
};
|
|
32
14
|
var default_default = Default;
|
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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefaultValue } from './src/default/index.mjs';
|
|
2
1
|
import * as moment from 'moment';
|
|
3
2
|
|
|
4
3
|
declare class Utils {
|
|
@@ -8,6 +7,7 @@ declare class Utils {
|
|
|
8
7
|
address(data: any): string;
|
|
9
8
|
match(value: any): string | any[];
|
|
10
9
|
money: (value: any, notSign?: boolean) => string;
|
|
10
|
+
cssProperties: (styles: any) => any;
|
|
11
11
|
};
|
|
12
12
|
static mask: {
|
|
13
13
|
docNumber: (value: any) => any;
|
|
@@ -31,8 +31,19 @@ declare class Utils {
|
|
|
31
31
|
number: (value: any) => any;
|
|
32
32
|
};
|
|
33
33
|
static default: {
|
|
34
|
-
|
|
34
|
+
credentials: {
|
|
35
|
+
page: number;
|
|
36
|
+
limit: number;
|
|
37
|
+
order: {
|
|
38
|
+
createdAt: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
pagination: {
|
|
42
|
+
content: never[];
|
|
43
|
+
total: number;
|
|
44
|
+
totalPage: number;
|
|
45
|
+
};
|
|
35
46
|
};
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
export {
|
|
49
|
+
export { Utils as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefaultValue } from './src/default/index.js';
|
|
2
1
|
import * as moment from 'moment';
|
|
3
2
|
|
|
4
3
|
declare class Utils {
|
|
@@ -8,6 +7,7 @@ declare class Utils {
|
|
|
8
7
|
address(data: any): string;
|
|
9
8
|
match(value: any): string | any[];
|
|
10
9
|
money: (value: any, notSign?: boolean) => string;
|
|
10
|
+
cssProperties: (styles: any) => any;
|
|
11
11
|
};
|
|
12
12
|
static mask: {
|
|
13
13
|
docNumber: (value: any) => any;
|
|
@@ -31,8 +31,19 @@ declare class Utils {
|
|
|
31
31
|
number: (value: any) => any;
|
|
32
32
|
};
|
|
33
33
|
static default: {
|
|
34
|
-
|
|
34
|
+
credentials: {
|
|
35
|
+
page: number;
|
|
36
|
+
limit: number;
|
|
37
|
+
order: {
|
|
38
|
+
createdAt: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
pagination: {
|
|
42
|
+
content: never[];
|
|
43
|
+
total: number;
|
|
44
|
+
totalPage: number;
|
|
45
|
+
};
|
|
35
46
|
};
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
export {
|
|
49
|
+
export { Utils as default };
|
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;
|
|
@@ -196,34 +208,16 @@ var RemoveMask = {
|
|
|
196
208
|
var remove_mask_default = RemoveMask;
|
|
197
209
|
|
|
198
210
|
// src/default/index.ts
|
|
199
|
-
var import_lodash3 = __toESM(require("lodash"));
|
|
200
211
|
var Default = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
result[key] = 0;
|
|
211
|
-
break;
|
|
212
|
-
case "boolean":
|
|
213
|
-
result[key] = "";
|
|
214
|
-
break;
|
|
215
|
-
case "object":
|
|
216
|
-
if (import_lodash3.default.isArray(value)) {
|
|
217
|
-
result[key] = [];
|
|
218
|
-
} else if (value !== null) {
|
|
219
|
-
result[key] = Default.build(value);
|
|
220
|
-
}
|
|
221
|
-
break;
|
|
222
|
-
default:
|
|
223
|
-
result[key] = null;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return result;
|
|
212
|
+
credentials: {
|
|
213
|
+
page: 1,
|
|
214
|
+
limit: 10,
|
|
215
|
+
order: { createdAt: "desc" }
|
|
216
|
+
},
|
|
217
|
+
pagination: {
|
|
218
|
+
content: [],
|
|
219
|
+
total: 0,
|
|
220
|
+
totalPage: 0
|
|
227
221
|
}
|
|
228
222
|
};
|
|
229
223
|
var default_default = Default;
|
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;
|
|
@@ -160,34 +172,16 @@ var RemoveMask = {
|
|
|
160
172
|
var remove_mask_default = RemoveMask;
|
|
161
173
|
|
|
162
174
|
// src/default/index.ts
|
|
163
|
-
import _3 from "lodash";
|
|
164
175
|
var Default = {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
result[key] = 0;
|
|
175
|
-
break;
|
|
176
|
-
case "boolean":
|
|
177
|
-
result[key] = "";
|
|
178
|
-
break;
|
|
179
|
-
case "object":
|
|
180
|
-
if (_3.isArray(value)) {
|
|
181
|
-
result[key] = [];
|
|
182
|
-
} else if (value !== null) {
|
|
183
|
-
result[key] = Default.build(value);
|
|
184
|
-
}
|
|
185
|
-
break;
|
|
186
|
-
default:
|
|
187
|
-
result[key] = null;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return result;
|
|
176
|
+
credentials: {
|
|
177
|
+
page: 1,
|
|
178
|
+
limit: 10,
|
|
179
|
+
order: { createdAt: "desc" }
|
|
180
|
+
},
|
|
181
|
+
pagination: {
|
|
182
|
+
content: [],
|
|
183
|
+
total: 0,
|
|
184
|
+
totalPage: 0
|
|
191
185
|
}
|
|
192
186
|
};
|
|
193
187
|
var default_default = Default;
|