@dzeio/schema 0.2.1 → 0.3.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/dist/Schema.d.mts +5 -0
- package/dist/Schema.d.ts +5 -0
- package/dist/Schema.js +7 -0
- package/dist/Schema.mjs +7 -0
- package/package.json +1 -1
package/dist/Schema.d.mts
CHANGED
|
@@ -153,6 +153,11 @@ declare class SchemaArray<Type extends SchemaItem> extends SchemaItem<Array<Sche
|
|
|
153
153
|
* transform the array so it only contains one of each elements
|
|
154
154
|
*/
|
|
155
155
|
unique(): this;
|
|
156
|
+
/**
|
|
157
|
+
* split a string into an array
|
|
158
|
+
* @param [separator] default:`,` the separator to use
|
|
159
|
+
*/
|
|
160
|
+
split(separator?: string): void;
|
|
156
161
|
parse(input: unknown, options?: {
|
|
157
162
|
fast?: boolean;
|
|
158
163
|
}): ValidationResult<Array<SchemaInfer<Type>>>;
|
package/dist/Schema.d.ts
CHANGED
|
@@ -153,6 +153,11 @@ declare class SchemaArray<Type extends SchemaItem> extends SchemaItem<Array<Sche
|
|
|
153
153
|
* transform the array so it only contains one of each elements
|
|
154
154
|
*/
|
|
155
155
|
unique(): this;
|
|
156
|
+
/**
|
|
157
|
+
* split a string into an array
|
|
158
|
+
* @param [separator] default:`,` the separator to use
|
|
159
|
+
*/
|
|
160
|
+
split(separator?: string): void;
|
|
156
161
|
parse(input: unknown, options?: {
|
|
157
162
|
fast?: boolean;
|
|
158
163
|
}): ValidationResult<Array<SchemaInfer<Type>>>;
|
package/dist/Schema.js
CHANGED
|
@@ -224,6 +224,13 @@ var SchemaArray = class extends SchemaItem {
|
|
|
224
224
|
this.postProcess.push((input) => input.filter((it, idx) => input.indexOf(it) === idx));
|
|
225
225
|
return this;
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* split a string into an array
|
|
229
|
+
* @param [separator] default:`,` the separator to use
|
|
230
|
+
*/
|
|
231
|
+
split(separator = ",") {
|
|
232
|
+
this.addPreProcess((it) => typeof it === "string" ? it.split(separator) : it);
|
|
233
|
+
}
|
|
227
234
|
parse(input, options) {
|
|
228
235
|
const { valid, object, errors = [] } = super.parse(input, options);
|
|
229
236
|
if (!valid) {
|
package/dist/Schema.mjs
CHANGED
|
@@ -181,6 +181,13 @@ var SchemaArray = class extends SchemaItem {
|
|
|
181
181
|
this.postProcess.push((input) => input.filter((it, idx) => input.indexOf(it) === idx));
|
|
182
182
|
return this;
|
|
183
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* split a string into an array
|
|
186
|
+
* @param [separator] default:`,` the separator to use
|
|
187
|
+
*/
|
|
188
|
+
split(separator = ",") {
|
|
189
|
+
this.addPreProcess((it) => typeof it === "string" ? it.split(separator) : it);
|
|
190
|
+
}
|
|
184
191
|
parse(input, options) {
|
|
185
192
|
const { valid, object, errors = [] } = super.parse(input, options);
|
|
186
193
|
if (!valid) {
|