@dzeio/schema 0.10.0 → 0.11.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 +1 -0
- package/dist/Schema.d.ts +1 -0
- package/dist/Schema.js +6 -0
- package/dist/Schema.mjs +6 -0
- package/package.json +1 -1
package/dist/Schema.d.mts
CHANGED
|
@@ -164,6 +164,7 @@ declare class SchemaAny extends SchemaItem {
|
|
|
164
164
|
type DateFormat = 'default' | 'iso8601' | 'yy-mm-dd' | 'jj/mm/yy';
|
|
165
165
|
declare class SchemaDate extends SchemaItem<Date> {
|
|
166
166
|
static readonly id = "date";
|
|
167
|
+
constructor();
|
|
167
168
|
parseString(format?: DateFormat): this;
|
|
168
169
|
isOfType(input: unknown): input is Date;
|
|
169
170
|
}
|
package/dist/Schema.d.ts
CHANGED
|
@@ -164,6 +164,7 @@ declare class SchemaAny extends SchemaItem {
|
|
|
164
164
|
type DateFormat = 'default' | 'iso8601' | 'yy-mm-dd' | 'jj/mm/yy';
|
|
165
165
|
declare class SchemaDate extends SchemaItem<Date> {
|
|
166
166
|
static readonly id = "date";
|
|
167
|
+
constructor();
|
|
167
168
|
parseString(format?: DateFormat): this;
|
|
168
169
|
isOfType(input: unknown): input is Date;
|
|
169
170
|
}
|
package/dist/Schema.js
CHANGED
|
@@ -387,6 +387,12 @@ SchemaAny.id = "any";
|
|
|
387
387
|
|
|
388
388
|
// src/items/date.ts
|
|
389
389
|
var SchemaDate = class extends SchemaItem {
|
|
390
|
+
// overide the basic constructor to check that the date has a valid format
|
|
391
|
+
// purpose : reject incorrect date like '2020-30-45'
|
|
392
|
+
constructor() {
|
|
393
|
+
super();
|
|
394
|
+
this.addValidation((input) => !Number.isNaN(input.getDate()));
|
|
395
|
+
}
|
|
390
396
|
parseString(format = "default") {
|
|
391
397
|
this.addPreProcess((input) => {
|
|
392
398
|
if (typeof input !== "string") {
|
package/dist/Schema.mjs
CHANGED
|
@@ -335,6 +335,12 @@ SchemaAny.id = "any";
|
|
|
335
335
|
|
|
336
336
|
// src/items/date.ts
|
|
337
337
|
var SchemaDate = class extends SchemaItem {
|
|
338
|
+
// overide the basic constructor to check that the date has a valid format
|
|
339
|
+
// purpose : reject incorrect date like '2020-30-45'
|
|
340
|
+
constructor() {
|
|
341
|
+
super();
|
|
342
|
+
this.addValidation((input) => !Number.isNaN(input.getDate()));
|
|
343
|
+
}
|
|
338
344
|
parseString(format = "default") {
|
|
339
345
|
this.addPreProcess((input) => {
|
|
340
346
|
if (typeof input !== "string") {
|