@altiore/form
Advanced tools
Comparing version 3.3.5 to 3.3.6
@@ -7,6 +7,6 @@ import { getErrorMessage } from '../@common/get-error-message'; | ||
if (typeof namePasswordField !== 'string') { | ||
throw new Error("\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u0438 \"" + typeof value + "\" \u043F\u0435\u0440\u0435\u0434\u0430\u043D \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \"comparePassword\""); | ||
throw new Error("\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u043E\u043B\u0435, \u0441 \u043A\u043E\u0442\u043E\u0440\u044B\u043C \u0445\u043E\u0442\u0438\u0442\u0435 \u0441\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \"" + value + "\" \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \"comparePassword('password')\""); | ||
} | ||
if (!getFieldValueByName) { | ||
throw new Error("\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440 \u0444\u043E\u0440\u043C\u044B \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C getFieldValueByName \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u0434\u043B\u044F \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B"); | ||
throw new Error("\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440 \"comparePassword\" \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C getFieldValueByName \u0444\u0443\u043D\u043A\u0446\u0438\u044E \u0434\u043B\u044F \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B"); | ||
} | ||
@@ -13,0 +13,0 @@ var firstPassword = getFieldValueByName(namePasswordField); |
@@ -5,7 +5,7 @@ import { getErrorMessage } from '../@common/get-error-message'; | ||
return function (value) { | ||
if (typeof value !== 'string') { | ||
throw new Error("\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u0438 \"" + typeof value + "\" \u043F\u0435\u0440\u0435\u0434\u0430\u043D \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \"isEmail\""); | ||
if (value === undefined || value === null) { | ||
return undefined; | ||
} | ||
var regexpEmail = /^(([^<>()[\]\\.,;:\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,}))$/; | ||
if (!regexpEmail.test(value)) { | ||
if (typeof value !== 'string' || !regexpEmail.test(value)) { | ||
var defError = "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 email"; | ||
@@ -12,0 +12,0 @@ return getErrorMessage(value, value, defError, getMessage); |
import { getErrorMessage } from '../@common/get-error-message'; | ||
export var maxLength = function (getMessage, length) { | ||
if (getMessage === void 0) { getMessage = null; } | ||
return function (value) { | ||
if (typeof (value === null || value === void 0 ? void 0 : value.length) !== 'number') { | ||
throw new Error("\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u0438 \"" + typeof value + "\" \u043F\u0435\u0440\u0435\u0434\u0430\u043D \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \"minLength\""); | ||
} | ||
return function (value, fieldName) { | ||
if (length < 0) { | ||
throw new Error("\u0417\u0430\u0434\u0430\u043D\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 \u043D\u0443\u043B\u044F"); | ||
} | ||
if (value === undefined || value === null) { | ||
return undefined; | ||
} | ||
if (typeof (value === null || value === void 0 ? void 0 : value.length) !== 'number') { | ||
var defError = "\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0434\u043B\u0438\u043D\u0443 \u043F\u043E\u043B\u044F \"" + fieldName + "\" - \u043D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0442\u0438\u043F \u0434\u0430\u043D\u043D\u044B\u0445"; | ||
return getErrorMessage(value, length, defError, getMessage); | ||
} | ||
if (value.length > length) { | ||
@@ -12,0 +16,0 @@ var defError = "\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430 \u0432\u0432\u0435\u0434\u0435\u043D\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F - " + length; |
import { getErrorMessage } from '../@common/get-error-message'; | ||
export var minLength = function (getMessage, length) { | ||
if (getMessage === void 0) { getMessage = null; } | ||
return function (value) { | ||
if (typeof (value === null || value === void 0 ? void 0 : value.length) !== 'number') { | ||
throw new Error("\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u0438 \"" + typeof value + "\" \u043F\u0435\u0440\u0435\u0434\u0430\u043D \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \"minLength\""); | ||
} | ||
return function (value, fieldName) { | ||
if (length < 0) { | ||
throw new Error("\u0417\u0430\u0434\u0430\u043D\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 \u043D\u0443\u043B\u044F"); | ||
} | ||
if (value === undefined || value === null) { | ||
return undefined; | ||
} | ||
if (typeof (value === null || value === void 0 ? void 0 : value.length) !== 'number') { | ||
var defError = "\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0434\u043B\u0438\u043D\u0443 \u043F\u043E\u043B\u044F \"" + fieldName + "\" - \u043D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0442\u0438\u043F \u0434\u0430\u043D\u043D\u044B\u0445"; | ||
return getErrorMessage(value, length, defError, getMessage); | ||
} | ||
if (value.length < length) { | ||
@@ -12,0 +16,0 @@ var defError = "\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430 \u0432\u0432\u0435\u0434\u0435\u043D\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F - " + length; |
import { getErrorMessage } from '../@common/get-error-message'; | ||
export var regexp = function (getMessage, regex) { | ||
return function (value) { | ||
var stringedValue = value.toString(); | ||
return function (value, fieldName) { | ||
if (value === undefined || value === null) { | ||
return undefined; | ||
} | ||
if (typeof value !== 'string') { | ||
var defError = "\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043F\u043E\u043B\u0435 \"" + fieldName + "\" - \u043D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0442\u0438\u043F \u0434\u0430\u043D\u043D\u044B\u0445"; | ||
return getErrorMessage(value, length, defError, getMessage); | ||
} | ||
var stringedValue = String(value); | ||
if (!regex.test(stringedValue)) { | ||
@@ -6,0 +13,0 @@ var defError = "\"" + stringedValue + "\" \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u0435\u0442 \u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u043C\u0443 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044E " + regex; |
{ | ||
"name": "@altiore/form", | ||
"version": "3.3.5", | ||
"version": "3.3.6", | ||
"description": "Form helper for building powerful forms", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102170
1611