Take in functions as defaults

This commit is contained in:
1ilit
2024-04-24 11:49:00 +03:00
parent ca8ee61ee9
commit 2751a6d6df
3 changed files with 9 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import { strHasQuotes } from "./utils";
import { isFunction, strHasQuotes } from "./utils";
function validateDateStr(str) {
return /^(?!0000)(?!00)(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[01])|(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31))$/.test(
@@ -9,6 +9,8 @@ function validateDateStr(str) {
function checkDefault(field) {
if (field.default === "") return true;
if (isFunction(field.default)) return true;
switch (field.type) {
case "INT":
case "BIGINT":