@epilot/validators
Advanced tools
| import { ErrorObject } from 'ajv'; | ||
| declare type SchemaValidateFunction = { | ||
| (schema: any, data: any): boolean | Promise<any>; | ||
| errors?: Partial<ErrorObject>[]; | ||
| }; | ||
| declare type SchemaKeyword = { | ||
| keyword: string; | ||
| callback: (schema: any, data: any) => boolean; | ||
| errorMessage: { | ||
| [locale: string]: string; | ||
| }; | ||
| }; | ||
| export declare const schemaKeywords: SchemaKeyword[]; | ||
| export declare function validateSchemaKeyword(schemaKeyword: SchemaKeyword, locale?: string): SchemaValidateFunction; | ||
| export {}; |
| import regExpStatments from './reg_exps' | ||
| import { ErrorObject } from 'ajv' | ||
| import { parseDateDE } from './validators' | ||
| type SchemaValidateFunction = { | ||
| (schema: any, data: any): | ||
| | boolean | ||
| | Promise<any> | ||
| errors?: Partial<ErrorObject>[] | ||
| } | ||
| type SchemaKeyword = { | ||
| keyword: string | ||
| callback: (schema: any, data: any) => boolean | ||
| errorMessage: { | ||
| [locale: string]: string | ||
| } | ||
| } | ||
| export const schemaKeywords: SchemaKeyword[] = [ | ||
| { | ||
| keyword: 'email', | ||
| callback: (schema: boolean, data: string) => | ||
| schema ? regExpStatments.email.regex.test(data) : false, | ||
| errorMessage: { | ||
| en: 'Please enter a valid email address.', | ||
| de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'onlyLetters', | ||
| callback: (schema: boolean, data: string) => | ||
| schema ? /^[a-zA-Z]+$/.test(data) : false, | ||
| errorMessage: { | ||
| en: 'Only letters allowed.', | ||
| de: 'Nur Buchstaben erlaubt.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'onlyNumbers', | ||
| callback: (schema: boolean, data: string) => | ||
| schema ? /^[0-9]+$/.test(data) : false, | ||
| errorMessage: { | ||
| en: 'Only numbers allowed.', | ||
| de: 'Nur Zahlen erlaubt.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'dateDE', | ||
| callback: (schema: boolean, data: string) => | ||
| schema | ||
| ? regExpStatments.date_de.regex.test(data) | ||
| : false, | ||
| errorMessage: { | ||
| en: 'Date should have the format DD.MM.YYYY.', | ||
| de: 'Das Datum sollte das Format TT.MM.JJJJ haben.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'minNumbersTelephone', | ||
| callback: (schema: number, data: string) => | ||
| schema && typeof schema === 'number' | ||
| ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data) | ||
| : false, | ||
| errorMessage: { | ||
| en: 'Please enter a valid telephone number.', | ||
| de: 'Bitte geben Sie eine gültige Telefonnummer ein.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'futureDateDE', | ||
| callback: (schema: number, data: string) => | ||
| schema && typeof schema === 'number' | ||
| ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000) | ||
| : false, | ||
| errorMessage: { | ||
| en: 'The date must be at least {schema} days in the future.', | ||
| de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.' | ||
| } | ||
| }, | ||
| { | ||
| keyword: 'birthdateDE', | ||
| callback: (schema: boolean, data: string) => | ||
| schema | ||
| ? parseDateDE(data).getTime() < new Date().getTime() | ||
| : false, | ||
| errorMessage: { | ||
| en: 'Please enter a valid date of birth.', | ||
| de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.' | ||
| } | ||
| } | ||
| ] | ||
| export function validateSchemaKeyword( | ||
| schemaKeyword: SchemaKeyword, | ||
| locale?: string | ||
| ): SchemaValidateFunction { | ||
| const { keyword, callback, errorMessage } = schemaKeyword | ||
| const validate: SchemaValidateFunction = (schema: any, data: any) => { | ||
| validate.errors = [ | ||
| { | ||
| keyword, | ||
| message: errorMessage | ||
| ? errorMessage[locale || 'de'].replace('{schema}', schema) | ||
| : locale === 'en' | ||
| ? 'The entered format is invalid.' | ||
| : 'Das eingegebene Format ist ungültig.', | ||
| params: { keyword } | ||
| } | ||
| ] | ||
| return callback(schema, data) | ||
| } | ||
| return validate | ||
| } |
+7
-0
@@ -5,2 +5,9 @@ # Changelog | ||
| ### [0.0.11](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.10...v0.0.11) (2021-05-21) | ||
| ### Features | ||
| * mo-274 translate error messages ([39b5da7](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/39b5da77320693115a5ec71c7b2fe82d3d6b15d9)) | ||
| ### [0.0.10](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.9...v0.0.10) (2021-05-04) | ||
@@ -7,0 +14,0 @@ |
| export { default as regExpStatments } from './reg_exps'; | ||
| export * from './validators'; | ||
| export * from './schema_keywords'; |
@@ -14,2 +14,3 @@ import IBAN from 'iban'; | ||
| export declare function validateFutureDate(data: string): boolean; | ||
| export declare function parseDateDE(dateStr: string): Date; | ||
| declare type FunctionalValidators = { | ||
@@ -16,0 +17,0 @@ [key: string]: { |
@@ -43,3 +43,3 @@ 'use strict'; | ||
| regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/, | ||
| description: 'this pattern is used to validate that the input is valid german date DD.MM.YYY' | ||
| description: 'this pattern is used to validate that the input is valid german date DD.MM.YYYY' | ||
| } | ||
@@ -82,3 +82,2 @@ }; | ||
| } | ||
| function parseDateDE(dateStr) { | ||
@@ -96,3 +95,2 @@ var dateArray = dateStr.split('.'); | ||
| function validateIBAN(data) { | ||
@@ -120,8 +118,94 @@ return IBAN.isValid(data); | ||
| var schemaKeywords = [{ | ||
| keyword: 'email', | ||
| callback: function callback(schema, data) { | ||
| return schema ? regExpStatments.email.regex.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid email address.', | ||
| de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.' | ||
| } | ||
| }, { | ||
| keyword: 'onlyLetters', | ||
| callback: function callback(schema, data) { | ||
| return schema ? /^[a-zA-Z]+$/.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Only letters allowed.', | ||
| de: 'Nur Buchstaben erlaubt.' | ||
| } | ||
| }, { | ||
| keyword: 'onlyNumbers', | ||
| callback: function callback(schema, data) { | ||
| return schema ? /^[0-9]+$/.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Only numbers allowed.', | ||
| de: 'Nur Zahlen erlaubt.' | ||
| } | ||
| }, { | ||
| keyword: 'dateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema ? regExpStatments.date_de.regex.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Date should have the format DD.MM.YYYY.', | ||
| de: 'Das Datum sollte das Format TT.MM.JJJJ haben.' | ||
| } | ||
| }, { | ||
| keyword: 'minNumbersTelephone', | ||
| callback: function callback(schema, data) { | ||
| return schema && typeof schema === 'number' ? new RegExp("^[+]*[0-9]{" + schema + ",}$").test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid telephone number.', | ||
| de: 'Bitte geben Sie eine gültige Telefonnummer ein.' | ||
| } | ||
| }, { | ||
| keyword: 'futureDateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema && typeof schema === 'number' ? parseDateDE(data).getTime() > new Date().getTime() + schema * 24 * 60 * 60 * 1000 : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'The date must be at least {schema} days in the future.', | ||
| de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.' | ||
| } | ||
| }, { | ||
| keyword: 'birthdateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema ? parseDateDE(data).getTime() < new Date().getTime() : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid date of birth.', | ||
| de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.' | ||
| } | ||
| }]; | ||
| function validateSchemaKeyword(schemaKeyword, locale) { | ||
| var keyword = schemaKeyword.keyword, | ||
| callback = schemaKeyword.callback, | ||
| errorMessage = schemaKeyword.errorMessage; | ||
| var validate = function validate(schema, data) { | ||
| validate.errors = [{ | ||
| keyword: keyword, | ||
| message: errorMessage ? errorMessage[locale || 'de'].replace('{schema}', schema) : locale === 'en' ? 'The entered format is invalid.' : 'Das eingegebene Format ist ungültig.', | ||
| params: { | ||
| keyword: keyword | ||
| } | ||
| }]; | ||
| return callback(schema, data); | ||
| }; | ||
| return validate; | ||
| } | ||
| exports.IBAN_Specifications = IBAN_Specifications; | ||
| exports.functionalValidators = functionalValidators; | ||
| exports.parseDateDE = parseDateDE; | ||
| exports.regExpStatments = regExpStatments; | ||
| exports.schemaKeywords = schemaKeywords; | ||
| exports.validateBirthDate = validateBirthDate; | ||
| exports.validateFutureDate = validateFutureDate; | ||
| exports.validateIBAN = validateIBAN; | ||
| exports.validateSchemaKeyword = validateSchemaKeyword; | ||
| //# sourceMappingURL=validators.cjs.development.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validators.cjs.development.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nfunction parseDateDE(dateStr: string) {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries"],"mappings":";;;;;;;;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,uJAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,gBAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAPoB;AActCE,EAAAA,gBAAgB,EAAE;AAChBJ,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,aAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAdoB;AAqBtCG,EAAAA,kBAAkB,EAAE;AAClBL,IAAAA,IAAI,EAAE,oBADY;AAElBC,IAAAA,KAAK,EAAE,iBAFW;AAGlBC,IAAAA,WAAW,EACT;AAJgB,GArBkB;AA4BtCI,EAAAA,eAAe,EAAE;AACfN,IAAAA,IAAI,EAAE,iBADS;AAEfC,IAAAA,KAAK,EAAE,gBAFQ;AAGfC,IAAAA,WAAW,EACT;AAJa,GA5BqB;AAmCtCK,EAAAA,iBAAiB,EAAE;AACjBP,IAAAA,IAAI,EAAE,mBADW;AAEjBC,IAAAA,KAAK,EAAE,eAFU;AAGjBC,IAAAA,WAAW,EACT;AAJe,GAnCmB;AA0CtCM,EAAAA,OAAO,EAAE;AACPR,IAAAA,IAAI,EAAE,SADC;AAEPC,IAAAA,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,MADF;AAEJ2B,IAAAA,QAAQ,EAAEL,YAFN;AAGJpB,IAAAA,WAAW,EACT;AAJE,GADkD;AAOxD0B,EAAAA,UAAU,EAAE;AACV5B,IAAAA,IAAI,EAAE,YADI;AAEV2B,IAAAA,QAAQ,EAAElB,iBAFA;AAGVP,IAAAA,WAAW,EACT;AAJQ,GAP4C;AAaxD2B,EAAAA,cAAc,EAAE;AACd7B,IAAAA,IAAI,EAAE,gBADQ;AAEd2B,IAAAA,QAAQ,EAAEX,kBAFI;AAGdd,IAAAA,WAAW,EACT;AAJY;AAbwC,CAAnD;AAqBP,IAAa4B,mBAAmB,GAAGP,IAAI,CAACQ,SAAjC;;;;;;;;;"} | ||
| {"version":3,"file":"validators.cjs.development.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","validateSchemaKeyword","schemaKeyword","locale","validate","errors","message","replace","params"],"mappings":";;;;;;;;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,uJAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,gBAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAPoB;AActCE,EAAAA,gBAAgB,EAAE;AAChBJ,IAAAA,IAAI,EAAE,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CAAZ,CAA6BI,OAA7B,CAAqC,UAArC,EAAiDX,MAAjD,CADiB,GAEjBO,MAAM,KAAK,IAAX,GACA,gCADA,GAEA,sCANN;AAOEK,MAAAA,MAAM,EAAE;AAAEb,QAAAA,OAAO,EAAPA;AAAF;AAPV,KADgB,CAAlB;AAYA,WAAON,QAAQ,CAACO,MAAD,EAASxB,IAAT,CAAf;AACD,GAdD;;AAgBA,SAAOgC,QAAP;AACD;;;;;;;;;;;;"} |
@@ -1,2 +0,2 @@ | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("iban"))&&"object"==typeof e&&"default"in e?e.default:e,i={email:{name:"email",regex:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,description:"this pattern is used to check if the email is valid"},lettersMinimum_3:{name:"lettersMinimum_3",regex:/^[a-zA-Z]{3,}$/,description:"this pattern is used to validate that the input length is at least 3 letter"},numbersMinimum_6:{name:"numbersMinimum_6",regex:/^[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers"},numbersTelephone_6:{name:"numbersTelephone_6",regex:/^[+]*[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign"},numbersExact_11:{name:"numbersExact_11",regex:/^[0-9]{11,11}$/,description:"this pattern is used to validate that the input length exactly 12 numbers"},numbersMaximum_11:{name:"numbersMaximum_11",regex:/^[0-9]{1,11}$/,description:"this pattern is used to validate that the input length is maximum 11 numbers"},date_de:{name:"date_de",regex:/^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,description:"this pattern is used to validate that the input is valid german date DD.MM.YYY"}};function a(e){return!!(i.date_de.regex.test(e)&&s(e).getTime()<(new Date).getTime())}function n(e){return!!(i.date_de.regex.test(e)&&s(e).getTime()>(new Date).getTime()+12096e5)}function s(e){var t=e.split("."),i=new Date;return i.setFullYear(+t[2],+t[1]-1,+t[0]),i}function r(e){return t.isValid(e)}var u={iban:{name:"iban",callback:r,description:"this validation function will validate the syntax of the provided iban"},birth_date:{name:"birth_date",callback:a,description:"this function will validate that the date is in the past"},future_date_14:{name:"future_date_14",callback:n,description:"this function will validate that the date is in the future with 14 days at least"}};exports.IBAN_Specifications=t.countries,exports.functionalValidators=u,exports.regExpStatments=i,exports.validateBirthDate=a,exports.validateFutureDate=n,exports.validateIBAN=r; | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("iban"))&&"object"==typeof e&&"default"in e?e.default:e,a={email:{name:"email",regex:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,description:"this pattern is used to check if the email is valid"},lettersMinimum_3:{name:"lettersMinimum_3",regex:/^[a-zA-Z]{3,}$/,description:"this pattern is used to validate that the input length is at least 3 letter"},numbersMinimum_6:{name:"numbersMinimum_6",regex:/^[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers"},numbersTelephone_6:{name:"numbersTelephone_6",regex:/^[+]*[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign"},numbersExact_11:{name:"numbersExact_11",regex:/^[0-9]{11,11}$/,description:"this pattern is used to validate that the input length exactly 12 numbers"},numbersMaximum_11:{name:"numbersMaximum_11",regex:/^[0-9]{1,11}$/,description:"this pattern is used to validate that the input length is maximum 11 numbers"},date_de:{name:"date_de",regex:/^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,description:"this pattern is used to validate that the input is valid german date DD.MM.YYYY"}};function r(e){return!!(a.date_de.regex.test(e)&&n(e).getTime()<(new Date).getTime())}function i(e){return!!(a.date_de.regex.test(e)&&n(e).getTime()>(new Date).getTime()+12096e5)}function n(e){var t=e.split("."),a=new Date;return a.setFullYear(+t[2],+t[1]-1,+t[0]),a}function s(e){return t.isValid(e)}var l={iban:{name:"iban",callback:s,description:"this validation function will validate the syntax of the provided iban"},birth_date:{name:"birth_date",callback:r,description:"this function will validate that the date is in the past"},future_date_14:{name:"future_date_14",callback:i,description:"this function will validate that the date is in the future with 14 days at least"}},u=[{keyword:"email",callback:function(e,t){return!!e&&a.email.regex.test(t)},errorMessage:{en:"Please enter a valid email address.",de:"Bitte geben Sie eine gültige E-Mail-Adresse ein."}},{keyword:"onlyLetters",callback:function(e,t){return!!e&&/^[a-zA-Z]+$/.test(t)},errorMessage:{en:"Only letters allowed.",de:"Nur Buchstaben erlaubt."}},{keyword:"onlyNumbers",callback:function(e,t){return!!e&&/^[0-9]+$/.test(t)},errorMessage:{en:"Only numbers allowed.",de:"Nur Zahlen erlaubt."}},{keyword:"dateDE",callback:function(e,t){return!!e&&a.date_de.regex.test(t)},errorMessage:{en:"Date should have the format DD.MM.YYYY.",de:"Das Datum sollte das Format TT.MM.JJJJ haben."}},{keyword:"minNumbersTelephone",callback:function(e,t){return!(!e||"number"!=typeof e)&&new RegExp("^[+]*[0-9]{"+e+",}$").test(t)},errorMessage:{en:"Please enter a valid telephone number.",de:"Bitte geben Sie eine gültige Telefonnummer ein."}},{keyword:"futureDateDE",callback:function(e,t){return!(!e||"number"!=typeof e)&&n(t).getTime()>(new Date).getTime()+24*e*60*60*1e3},errorMessage:{en:"The date must be at least {schema} days in the future.",de:"Das Datum muss mind. {schema} Tage in der Zukunft liegen."}},{keyword:"birthdateDE",callback:function(e,t){return!!e&&n(t).getTime()<(new Date).getTime()},errorMessage:{en:"Please enter a valid date of birth.",de:"Bitte geben Sie ein gültiges Geburtsdatum ein."}}];exports.IBAN_Specifications=t.countries,exports.functionalValidators=l,exports.parseDateDE=n,exports.regExpStatments=a,exports.schemaKeywords=u,exports.validateBirthDate=r,exports.validateFutureDate=i,exports.validateIBAN=s,exports.validateSchemaKeyword=function(e,t){var a=e.keyword,r=e.callback,i=e.errorMessage;return function e(n,s){return e.errors=[{keyword:a,message:i?i[t||"de"].replace("{schema}",n):"en"===t?"The entered format is invalid.":"Das eingegebene Format ist ungültig.",params:{keyword:a}}],r(n,s)}}; | ||
| //# sourceMappingURL=validators.cjs.production.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validators.cjs.production.min.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nfunction parseDateDE(dateStr: string) {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","countries"],"mappings":"+IAQMA,EAAkC,CACtCC,MAAO,CACLC,KAAM,QACNC,MAAO,wJACPC,YAAa,uDAGfC,iBAAkB,CAChBH,KAAM,mBACNC,MAAO,iBACPC,YACE,+EAGJE,iBAAkB,CAChBJ,KAAM,mBACNC,MAAO,cACPC,YACE,gFAGJG,mBAAoB,CAClBL,KAAM,qBACNC,MAAO,kBACPC,YACE,+GAGJI,gBAAiB,CACfN,KAAM,kBACNC,MAAO,iBACPC,YACE,6EAGJK,kBAAmB,CACjBP,KAAM,oBACNC,MAAO,gBACPC,YACE,gFAGJM,QAAS,CACPR,KAAM,UACNC,MAAO,4CACPC,YACE,4FC9CUO,EAAkBC,YAChBZ,EAAgBU,QAAQP,MAG5BU,KAAKD,IACXE,EAAYF,GAAMG,WAAY,IAAIC,MAAOD,oBAcjCE,EAAmBL,YACjBZ,EAAgBU,QAAQP,MAG5BU,KAAKD,IACXE,EAAYF,GAAMG,WAAY,IAAIC,MAAOD,UAAW,SAQ5D,SAASD,EAAYI,OACbC,EAAYD,EAAQE,MAAM,KAC1BC,EAAO,IAAIL,YAEjBK,EAAKC,aAAaH,EAAU,IAAKA,EAAU,GAAK,GAAIA,EAAU,IAEvDE,WAgBOE,EAAaX,UACpBY,EAAKC,QAAQb,GAGtB,IAAac,EAA6C,CACxDC,KAAM,CACJzB,KAAM,OACN0B,SAAUL,EACVnB,YACE,0EAEJyB,WAAY,CACV3B,KAAM,aACN0B,SAAUjB,EACVP,YACE,4DAEJ0B,eAAgB,CACd5B,KAAM,iBACN0B,SAAUX,EACVb,YACE,iHAI6BoB,EAAKO"} | ||
| {"version":3,"file":"validators.cjs.production.min.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","countries","schemaKeyword","locale","validate","errors","message","replace","params"],"mappings":"+IAQMA,EAAkC,CACtCC,MAAO,CACLC,KAAM,QACNC,MAAO,wJACPC,YAAa,uDAGfC,iBAAkB,CAChBH,KAAM,mBACNC,MAAO,iBACPC,YACE,+EAGJE,iBAAkB,CAChBJ,KAAM,mBACNC,MAAO,cACPC,YACE,gFAGJG,mBAAoB,CAClBL,KAAM,qBACNC,MAAO,kBACPC,YACE,+GAGJI,gBAAiB,CACfN,KAAM,kBACNC,MAAO,iBACPC,YACE,6EAGJK,kBAAmB,CACjBP,KAAM,oBACNC,MAAO,gBACPC,YACE,gFAGJM,QAAS,CACPR,KAAM,UACNC,MAAO,4CACPC,YACE,6FC9CUO,EAAkBC,YAChBZ,EAAgBU,QAAQP,MAG5BU,KAAKD,IACXE,EAAYF,GAAMG,WAAY,IAAIC,MAAOD,oBAcjCE,EAAmBL,YACjBZ,EAAgBU,QAAQP,MAG5BU,KAAKD,IACXE,EAAYF,GAAMG,WAAY,IAAIC,MAAOD,UAAW,kBAQ5CD,EAAYI,OACpBC,EAAYD,EAAQE,MAAM,KAC1BC,EAAO,IAAIL,YAEjBK,EAAKC,aAAaH,EAAU,IAAKA,EAAU,GAAK,GAAIA,EAAU,IAEvDE,WAgBOE,EAAaX,UACpBY,EAAKC,QAAQb,GAGtB,IAAac,EAA6C,CACxDC,KAAM,CACJzB,KAAM,OACN0B,SAAUL,EACVnB,YACE,0EAEJyB,WAAY,CACV3B,KAAM,aACN0B,SAAUjB,EACVP,YACE,4DAEJ0B,eAAgB,CACd5B,KAAM,iBACN0B,SAAUX,EACVb,YACE,qFChEO2B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X,GACtC,OAAXO,EACA,iCACA,uCACJK,OAAQ,CAAEb,QAAAA,KAIPJ,EAASK,EAAQrB"} |
@@ -37,3 +37,3 @@ import IBAN from 'iban'; | ||
| regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/, | ||
| description: 'this pattern is used to validate that the input is valid german date DD.MM.YYY' | ||
| description: 'this pattern is used to validate that the input is valid german date DD.MM.YYYY' | ||
| } | ||
@@ -76,3 +76,2 @@ }; | ||
| } | ||
| function parseDateDE(dateStr) { | ||
@@ -90,3 +89,2 @@ var dateArray = dateStr.split('.'); | ||
| function validateIBAN(data) { | ||
@@ -114,3 +112,86 @@ return IBAN.isValid(data); | ||
| export { IBAN_Specifications, functionalValidators, regExpStatments, validateBirthDate, validateFutureDate, validateIBAN }; | ||
| var schemaKeywords = [{ | ||
| keyword: 'email', | ||
| callback: function callback(schema, data) { | ||
| return schema ? regExpStatments.email.regex.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid email address.', | ||
| de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.' | ||
| } | ||
| }, { | ||
| keyword: 'onlyLetters', | ||
| callback: function callback(schema, data) { | ||
| return schema ? /^[a-zA-Z]+$/.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Only letters allowed.', | ||
| de: 'Nur Buchstaben erlaubt.' | ||
| } | ||
| }, { | ||
| keyword: 'onlyNumbers', | ||
| callback: function callback(schema, data) { | ||
| return schema ? /^[0-9]+$/.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Only numbers allowed.', | ||
| de: 'Nur Zahlen erlaubt.' | ||
| } | ||
| }, { | ||
| keyword: 'dateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema ? regExpStatments.date_de.regex.test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Date should have the format DD.MM.YYYY.', | ||
| de: 'Das Datum sollte das Format TT.MM.JJJJ haben.' | ||
| } | ||
| }, { | ||
| keyword: 'minNumbersTelephone', | ||
| callback: function callback(schema, data) { | ||
| return schema && typeof schema === 'number' ? new RegExp("^[+]*[0-9]{" + schema + ",}$").test(data) : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid telephone number.', | ||
| de: 'Bitte geben Sie eine gültige Telefonnummer ein.' | ||
| } | ||
| }, { | ||
| keyword: 'futureDateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema && typeof schema === 'number' ? parseDateDE(data).getTime() > new Date().getTime() + schema * 24 * 60 * 60 * 1000 : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'The date must be at least {schema} days in the future.', | ||
| de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.' | ||
| } | ||
| }, { | ||
| keyword: 'birthdateDE', | ||
| callback: function callback(schema, data) { | ||
| return schema ? parseDateDE(data).getTime() < new Date().getTime() : false; | ||
| }, | ||
| errorMessage: { | ||
| en: 'Please enter a valid date of birth.', | ||
| de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.' | ||
| } | ||
| }]; | ||
| function validateSchemaKeyword(schemaKeyword, locale) { | ||
| var keyword = schemaKeyword.keyword, | ||
| callback = schemaKeyword.callback, | ||
| errorMessage = schemaKeyword.errorMessage; | ||
| var validate = function validate(schema, data) { | ||
| validate.errors = [{ | ||
| keyword: keyword, | ||
| message: errorMessage ? errorMessage[locale || 'de'].replace('{schema}', schema) : locale === 'en' ? 'The entered format is invalid.' : 'Das eingegebene Format ist ungültig.', | ||
| params: { | ||
| keyword: keyword | ||
| } | ||
| }]; | ||
| return callback(schema, data); | ||
| }; | ||
| return validate; | ||
| } | ||
| export { IBAN_Specifications, functionalValidators, parseDateDE, regExpStatments, schemaKeywords, validateBirthDate, validateFutureDate, validateIBAN, validateSchemaKeyword }; | ||
| //# sourceMappingURL=validators.esm.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validators.esm.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nfunction parseDateDE(dateStr: string) {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries"],"mappings":";;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,uJAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA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W,CAACH,IAAD,CAAX,CAAkBI,OAAlB,KAA8B,IAAIC,IAAJ,GAAWD,OAAX,KAAsB,KAAG,EAAH,GAAM,EAAN,GAAS,EAAT,GAAY,IAApE,EAA2E;AACzE,aAAO,IAAP;AACD;AACF;;AAED,SAAO,KAAP;AACD;;AAED,SAASD,WAAT,CAAqBI,OAArB;AACE,MAAMC,SAAS,GAAGD,OAAO,CAACE,KAAR,CAAc,GAAd,CAAlB;AACA,MAAMC,IAAI,GAAG,IAAIL,IAAJ,EAAb;AAEAK,EAAAA,IAAI,CAACC,WAAL,CAAiB,CAACH,SAAS,CAAC,CAAD,CAA3B,EAAgC,CAACA,SAAS,CAAC,CAAD,CAAV,GAAgB,CAAhD,EAAmD,CAACA,SAAS,CAAC,CAAD,CAA7D;AAEA,SAAOE,IAAP;AACD;AAUD;;;;;;;AAKA,SAAgBE,aAAaZ;AAC3B,SAAOa,IAAI,CAACC,OAAL,CAAad,IAAb,CAAP;AACD;AAED,IAAae,oBAAoB,GAAyB;AACxDC,EAAAA,IAAI,EAAE;AACJ1B,IAAAA,IAAI,EAAE,MADF;AAEJ2B,IAAAA,QAAQ,EAAEL,YAFN;AAGJpB,IAAAA,WAAW,EACT;AAJE,GADkD;AAOxD0B,EAAAA,UAAU,EAAE;AACV5B,IAAAA,IAAI,EAAE,YADI;AAEV2B,IAAAA,QAAQ,EAAElB,iBAFA;AAGVP,IAAAA,WAAW,EACT;AAJQ,GAP4C;AAaxD2B,EAAAA,cAAc,EAAE;AACd7B,IAAAA,IAAI,EAAE,gBADQ;AAEd2B,IAAAA,QAAQ,EAAEX,kBAFI;AAGdd,IAAAA,WAAW,EACT;AAJY;AAbwC,CAAnD;AAqBP,IAAa4B,mBAAmB,GAAGP,IAAI,CAACQ,SAAjC;;;;"} | ||
| {"version":3,"file":"validators.esm.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","validateBirthDate","data","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","isValid","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","validateSchemaKeyword","schemaKeyword","locale","validate","errors","message","replace","params"],"mappings":";;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,uJAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,gBAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAPoB;AActCE,EAAAA,gBAAgB,EAAE;AAChBJ,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,aAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAdoB;AAqBtCG,EAAAA,kBAAkB,EAAE;AAClBL,IAAAA,IAAI,EAAE,oBADY;AAElBC,IAAAA,KAAK,EAAE,iBAFW;AAGlBC,IAAAA,WAAW,EACT;AAJgB,GArBkB;AA4BtCI,EAAAA,eAAe,EAAE;AACfN,IAAAA,IAAI,EAAE,iBADS;AAEfC,IAAAA,KAAK,EAAE,gBAFQ;AAGfC,IAAAA,WAAW,EACT;AAJa,GA5BqB;AAmCtCK,EAAAA,iBAAiB,EAAE;AACjBP,IAAAA,IAAI,EAAE,mBADW;AAEjBC,IAAAA,KAAK,EAAE,eAFU;AAGjBC,IAAAA,WAAW,EACT;AAJe,GAnCmB;AA0CtCM,EAAAA,OAAO,EAAE;AACPR,IAAAA,IAAI,EAAE,SADC;AAEPC,IAAAA,KAAK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;AACEJ,EAAAA,OAAO,EAAE,aADX;AAEEN,EAAAA,QAAQ,EAAE,kBAACO,MAAD,EAAkBxB,IAAlB;AAAA,WACRwB,MAAM,GACFrB,WAAW,CAACH,IAAD,CAAX,CAAkBI,OAAlB,KAA8B,IAAIC,IAAJ,GAAWD,OAAX,EAD5B,GAEF,KAHI;AAAA,GAFZ;AAMEqB,EAAAA,YAAY,EAAE;AACZC,IAAAA,EAAE,EAAE,qCADQ;AAEZC,IAAAA,EAAE,EAAE;AAFQ;AANhB,CA7D6C,CAAxC;AA0EP,SAAgBE,sBACdC,eACAC;MAEQR,UAAoCO,cAApCP;MAASN,WAA2Ba,cAA3Bb;MAAUQ,eAAiBK,cAAjBL;;AAE3B,MAAMO,QAAQ,GAA2B,SAAnCA,QAAmC,CAACR,MAAD,EAAcxB,IAAd;AACvCgC,IAAAA,QAAQ,CAACC,MAAT,GAAkB,CAChB;AACEV,MAAAA,OAAO,EAAPA,OADF;AAEEW,MAAAA,OAAO,EAAET,YAAY,GACjBA,YAAY,CAACM,MAAM,IAAI,IAAX,CAAZ,CAA6BI,OAA7B,CAAqC,UAArC,EAAiDX,MAAjD,CADiB,GAEjBO,MAAM,KAAK,IAAX,GACA,gCADA,GAEA,sCANN;AAOEK,MAAAA,MAAM,EAAE;AAAEb,QAAAA,OAAO,EAAPA;AAAF;AAPV,KADgB,CAAlB;AAYA,WAAON,QAAQ,CAACO,MAAD,EAASxB,IAAT,CAAf;AACD,GAdD;;AAgBA,SAAOgC,QAAP;AACD;;;;"} |
+1
-1
| { | ||
| "name": "@epilot/validators", | ||
| "version": "0.0.10", | ||
| "version": "0.0.11", | ||
| "author": { | ||
@@ -5,0 +5,0 @@ "name": "epilot GmbH", |
| export { default as regExpStatments } from './reg_exps' | ||
| export * from './validators' | ||
| export * from './schema_keywords' |
@@ -55,3 +55,3 @@ type RegExpStatment = { | ||
| description: | ||
| 'this pattern is used to validate that the input is valid german date DD.MM.YYY' | ||
| 'this pattern is used to validate that the input is valid german date DD.MM.YYYY' | ||
| } | ||
@@ -58,0 +58,0 @@ } |
@@ -41,3 +41,3 @@ import regExpStatments from './reg_exps' | ||
| function parseDateDE(dateStr: string) { | ||
| export function parseDateDE(dateStr: string): Date { | ||
| const dateArray = dateStr.split('.') | ||
@@ -44,0 +44,0 @@ const date = new Date() |
64233
76.77%19
11.76%690
75.57%