yuppi 1.3.19 → 1.3.20
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/main.js +6 -6
- package/dist/main.mjs +6 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -122,12 +122,12 @@ var convertToYup = (schema, error_messages) => {
|
|
|
122
122
|
if (config.min !== void 0)
|
|
123
123
|
schema2 = schema2.min(
|
|
124
124
|
config.min,
|
|
125
|
-
({ path: path2, min }) => (error_messages?.string?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
125
|
+
({ path: path2, min }) => (error_messages?.string?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)).replaceAll("{plural_suffix}", min > 1 ? "s" : "")
|
|
126
126
|
);
|
|
127
127
|
if (config.max !== void 0)
|
|
128
128
|
schema2 = schema2.max(
|
|
129
129
|
config.max,
|
|
130
|
-
({ path: path2, max }) => (error_messages?.string?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
130
|
+
({ path: path2, max }) => (error_messages?.string?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)).replaceAll("{plural_suffix}", max > 1 ? "s" : "")
|
|
131
131
|
);
|
|
132
132
|
if (config.lowercase === true) schema2 = schema2.transform((property) => typeof property === "string" ? property.toLowerCase() : property);
|
|
133
133
|
if (config.uppercase === true) schema2 = schema2.transform((property) => typeof property === "string" ? property.toUpperCase() : property);
|
|
@@ -136,8 +136,8 @@ var convertToYup = (schema, error_messages) => {
|
|
|
136
136
|
} else if (config.type === "number") {
|
|
137
137
|
schema2 = Yup.number().typeError(({ path: path2 }) => (error_messages?.number?.type ?? "").replaceAll("{path}", path2));
|
|
138
138
|
if (config.enum) schema2 = schema2.oneOf(config.enum, ({ path: path2 }) => (error_messages?.number?.enum ?? "").replaceAll("{path}", path2));
|
|
139
|
-
if (config.min !== void 0) schema2 = schema2.min(config.min, ({ path: path2, min }) => (error_messages?.number?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
140
|
-
if (config.max !== void 0) schema2 = schema2.max(config.max, ({ path: path2, max }) => (error_messages?.number?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
139
|
+
if (config.min !== void 0) schema2 = schema2.min(config.min, ({ path: path2, min }) => (error_messages?.number?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)));
|
|
140
|
+
if (config.max !== void 0) schema2 = schema2.max(config.max, ({ path: path2, max }) => (error_messages?.number?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)));
|
|
141
141
|
if (config.integer === true) schema2 = schema2.integer(({ path: path2 }) => (error_messages?.number?.integer ?? "").replaceAll("{path}", path2));
|
|
142
142
|
if (config.positive === true) schema2 = schema2.positive(({ path: path2 }) => (error_messages?.number?.positive ?? "").replaceAll("{path}", path2));
|
|
143
143
|
if (config.negative === true) schema2 = schema2.negative(({ path: path2 }) => (error_messages?.number?.negative ?? "").replaceAll("{path}", path2));
|
|
@@ -165,12 +165,12 @@ var convertToYup = (schema, error_messages) => {
|
|
|
165
165
|
if (config.min !== void 0)
|
|
166
166
|
schema2 = schema2.min(
|
|
167
167
|
config.min,
|
|
168
|
-
({ path: path2, min }) => (error_messages?.array?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
168
|
+
({ path: path2, min }) => (error_messages?.array?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)).replaceAll("{plural_suffix}", min > 1 ? "s" : "")
|
|
169
169
|
);
|
|
170
170
|
if (config.max !== void 0)
|
|
171
171
|
schema2 = schema2.max(
|
|
172
172
|
config.max,
|
|
173
|
-
({ path: path2, max }) => (error_messages?.array?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
173
|
+
({ path: path2, max }) => (error_messages?.array?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)).replaceAll("{plural_suffix}", max > 1 ? "s" : "")
|
|
174
174
|
);
|
|
175
175
|
schema2 = schema2.of(build(key, config.items));
|
|
176
176
|
schema2 = base(schema2, key, config);
|
package/dist/main.mjs
CHANGED
|
@@ -91,12 +91,12 @@ var convertToYup = (schema, error_messages) => {
|
|
|
91
91
|
if (config.min !== void 0)
|
|
92
92
|
schema2 = schema2.min(
|
|
93
93
|
config.min,
|
|
94
|
-
({ path: path2, min }) => (error_messages?.string?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
94
|
+
({ path: path2, min }) => (error_messages?.string?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)).replaceAll("{plural_suffix}", min > 1 ? "s" : "")
|
|
95
95
|
);
|
|
96
96
|
if (config.max !== void 0)
|
|
97
97
|
schema2 = schema2.max(
|
|
98
98
|
config.max,
|
|
99
|
-
({ path: path2, max }) => (error_messages?.string?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
99
|
+
({ path: path2, max }) => (error_messages?.string?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)).replaceAll("{plural_suffix}", max > 1 ? "s" : "")
|
|
100
100
|
);
|
|
101
101
|
if (config.lowercase === true) schema2 = schema2.transform((property) => typeof property === "string" ? property.toLowerCase() : property);
|
|
102
102
|
if (config.uppercase === true) schema2 = schema2.transform((property) => typeof property === "string" ? property.toUpperCase() : property);
|
|
@@ -105,8 +105,8 @@ var convertToYup = (schema, error_messages) => {
|
|
|
105
105
|
} else if (config.type === "number") {
|
|
106
106
|
schema2 = Yup.number().typeError(({ path: path2 }) => (error_messages?.number?.type ?? "").replaceAll("{path}", path2));
|
|
107
107
|
if (config.enum) schema2 = schema2.oneOf(config.enum, ({ path: path2 }) => (error_messages?.number?.enum ?? "").replaceAll("{path}", path2));
|
|
108
|
-
if (config.min !== void 0) schema2 = schema2.min(config.min, ({ path: path2, min }) => (error_messages?.number?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
109
|
-
if (config.max !== void 0) schema2 = schema2.max(config.max, ({ path: path2, max }) => (error_messages?.number?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
108
|
+
if (config.min !== void 0) schema2 = schema2.min(config.min, ({ path: path2, min }) => (error_messages?.number?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)));
|
|
109
|
+
if (config.max !== void 0) schema2 = schema2.max(config.max, ({ path: path2, max }) => (error_messages?.number?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)));
|
|
110
110
|
if (config.integer === true) schema2 = schema2.integer(({ path: path2 }) => (error_messages?.number?.integer ?? "").replaceAll("{path}", path2));
|
|
111
111
|
if (config.positive === true) schema2 = schema2.positive(({ path: path2 }) => (error_messages?.number?.positive ?? "").replaceAll("{path}", path2));
|
|
112
112
|
if (config.negative === true) schema2 = schema2.negative(({ path: path2 }) => (error_messages?.number?.negative ?? "").replaceAll("{path}", path2));
|
|
@@ -134,12 +134,12 @@ var convertToYup = (schema, error_messages) => {
|
|
|
134
134
|
if (config.min !== void 0)
|
|
135
135
|
schema2 = schema2.min(
|
|
136
136
|
config.min,
|
|
137
|
-
({ path: path2, min }) => (error_messages?.array?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", min
|
|
137
|
+
({ path: path2, min }) => (error_messages?.array?.min ?? "").replaceAll("{path}", path2).replaceAll("{min}", String(min)).replaceAll("{plural_suffix}", min > 1 ? "s" : "")
|
|
138
138
|
);
|
|
139
139
|
if (config.max !== void 0)
|
|
140
140
|
schema2 = schema2.max(
|
|
141
141
|
config.max,
|
|
142
|
-
({ path: path2, max }) => (error_messages?.array?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", max
|
|
142
|
+
({ path: path2, max }) => (error_messages?.array?.max ?? "").replaceAll("{path}", path2).replaceAll("{max}", String(max)).replaceAll("{plural_suffix}", max > 1 ? "s" : "")
|
|
143
143
|
);
|
|
144
144
|
schema2 = schema2.of(build(key, config.items));
|
|
145
145
|
schema2 = base(schema2, key, config);
|