class-validator
Advanced tools
Comparing version 0.12.0-refactor.3 to 0.12.0-refactor.4
import { buildMessage, ValidateBy } from "./ValidateBy"; | ||
import validatorJsIsLatLong from "validator/lib/isLatLong"; | ||
import validator from "validator"; | ||
export const IS_LATLONG = "isLatLong"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isLatLong(value) { | ||
return typeof value === "string" && validatorJsIsLatLong(value); | ||
return typeof value === "string" && validator.isLatLong(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsDivisibleBy from "validator/lib/isDivisibleBy"; | ||
import validator from "validator"; | ||
export const IS_DIVISIBLE_BY = "isDivisibleBy"; | ||
@@ -10,3 +10,3 @@ /** | ||
typeof num === "number" && | ||
validatorJsIsDivisibleBy(String(value), num); | ||
validator.isDivisibleBy(String(value), num); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsContains from "validator/lib/contains"; | ||
import validator from "validator"; | ||
export const CONTAINS = "contains"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function contains(value, seed) { | ||
return typeof value === "string" && validatorJsContains(value, seed); | ||
return typeof value === "string" && validator.contains(value, seed); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsAscii from "validator/lib/isAscii"; | ||
import validator from "validator"; | ||
export const IS_ASCII = "isAscii"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isAscii(value) { | ||
return typeof value === "string" && validatorJsIsAscii(value); | ||
return typeof value === "string" && validator.isAscii(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsBase64 from "validator/lib/isBase64"; | ||
import validator from "validator"; | ||
export const IS_BASE64 = "isBase64"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isBase64(value) { | ||
return typeof value === "string" && validatorJsIsBase64(value); | ||
return typeof value === "string" && validator.isBase64(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsBoolean from "validator/lib/isBoolean"; | ||
import validator from "validator"; | ||
export const IS_BOOLEAN_STRING = "isBooleanString"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isBooleanString(value) { | ||
return typeof value === "string" && validatorJsIsBoolean(value); | ||
return typeof value === "string" && validator.isBoolean(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJjIsByteLength from "validator/lib/isByteLength"; | ||
import validator from "validator"; | ||
export const IS_BYTE_LENGTH = "isByteLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isByteLength(value, min, max) { | ||
return typeof value === "string" && validatorJjIsByteLength(value, { min, max }); | ||
return typeof value === "string" && validator.isByteLength(value, { min, max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsCreditCard from "validator/lib/isCreditCard"; | ||
import validator from "validator"; | ||
export const IS_CREDIT_CARD = "isCreditCard"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isCreditCard(value) { | ||
return typeof value === "string" && validatorJsIsCreditCard(value); | ||
return typeof value === "string" && validator.isCreditCard(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsFullWidth from "validator/lib/isFullWidth"; | ||
import validator from "validator"; | ||
export const IS_FULL_WIDTH = "isFullWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isFullWidth(value) { | ||
return typeof value === "string" && validatorJsIsFullWidth(value); | ||
return typeof value === "string" && validator.isFullWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHalfWidth from "validator/lib/isHalfWidth"; | ||
import validator from "validator"; | ||
export const IS_HALF_WIDTH = "isHalfWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isHalfWidth(value) { | ||
return typeof value === "string" && validatorJsIsHalfWidth(value); | ||
return typeof value === "string" && validator.isHalfWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHexadecimal from "validator/lib/isHexadecimal"; | ||
import validator from "validator"; | ||
export const IS_HEXADECIMAL = "isHexadecimal"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isHexadecimal(value) { | ||
return typeof value === "string" && validatorJsIsHexadecimal(value); | ||
return typeof value === "string" && validator.isHexadecimal(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHexColor from "validator/lib/isHexColor"; | ||
import validator from "validator"; | ||
export const IS_HEX_COLOR = "isHexColor"; | ||
@@ -10,3 +10,3 @@ /** | ||
// TODO: breaking change - https://github.com/validatorjs/validator.js/pull/1233 | ||
return typeof value === "string" && validatorJsIsHexColor(value); | ||
return typeof value === "string" && validator.isHexColor(value); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISIN from "validator/lib/isISIN"; | ||
import validator from "validator"; | ||
export const IS_ISIN = "isIsin"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isISIN(value) { | ||
return typeof value === "string" && validatorJsIsISIN(value); | ||
return typeof value === "string" && validator.isISIN(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISO31661Alpha2 from "validator/lib/isISO31661Alpha2"; | ||
import validator from "validator"; | ||
export const IS_ISO31661_ALPHA_2 = "isISO31661Alpha2"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isISO31661Alpha2(value) { | ||
return typeof value === "string" && validatorJsIsISO31661Alpha2(value); | ||
return typeof value === "string" && validator.isISO31661Alpha2(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISO31661Alpha3 from "validator/lib/isISO31661Alpha3"; | ||
import validator from "validator"; | ||
export const IS_ISO31661_ALPHA_3 = "isISO31661Alpha3"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isISO31661Alpha3(value) { | ||
return typeof value === "string" && validatorJsIsISO31661Alpha3(value); | ||
return typeof value === "string" && validator.isISO31661Alpha3(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsJSON from "validator/lib/isJSON"; | ||
import validator from "validator"; | ||
export const IS_JSON = "isJson"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isJSON(value) { | ||
return typeof value === "string" && validatorJsIsJSON(value); | ||
return typeof value === "string" && validator.isJSON(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsJWT from "validator/lib/isJWT"; | ||
import validator from "validator"; | ||
export const IS_JWT = "isJwt"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isJWT(value) { | ||
return typeof value === "string" && validatorJsIsJWT(value); | ||
return typeof value === "string" && validator.isJWT(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLowercase from "validator/lib/isLowercase"; | ||
import validator from "validator"; | ||
export const IS_LOWERCASE = "isLowercase"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isLowercase(value) { | ||
return typeof value === "string" && validatorJsIsLowercase(value); | ||
return typeof value === "string" && validator.isLowercase(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsMatches from "validator/lib/matches"; | ||
import validator from "validator"; | ||
export const IS_MILITARY_TIME = "isMilitaryTime"; | ||
@@ -10,3 +10,3 @@ /** | ||
const militaryTimeRegex = /^([01]\d|2[0-3]):?([0-5]\d)$/; | ||
return typeof value === "string" && validatorJsMatches(value, militaryTimeRegex); | ||
return typeof value === "string" && validator.matches(value, militaryTimeRegex); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsMongoId from "validator/lib/isMongoId"; | ||
import validator from "validator"; | ||
export const IS_MONGO_ID = "isMongoId"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isMongoId(value) { | ||
return typeof value === "string" && validatorJsIsMongoId(value); | ||
return typeof value === "string" && validator.isMongoId(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsMultibyte from "validator/lib/isMultibyte"; | ||
import validator from "validator"; | ||
export const IS_MULTIBYTE = "isMultibyte"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isMultibyte(value) { | ||
return typeof value === "string" && validatorJsIsMultibyte(value); | ||
return typeof value === "string" && validator.isMultibyte(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
const phoneUtil = require("google-libphonenumber").PhoneNumberUtil.getInstance(); | ||
import { PhoneNumberUtil } from "google-libphonenumber"; | ||
export const IS_PHONE_NUMBER = "isPhoneNumber"; | ||
@@ -12,2 +12,3 @@ /** | ||
export function isPhoneNumber(value, region) { | ||
const phoneUtil = PhoneNumberUtil.getInstance(); | ||
try { | ||
@@ -14,0 +15,0 @@ const phoneNum = phoneUtil.parseAndKeepRawInput(value, region); |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsPort from "validator/lib/isPort"; | ||
import validator from "validator"; | ||
export const IS_PORT = "isPort"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isPort(value) { | ||
return typeof value === "string" && validatorJsIsPort(value); | ||
return typeof value === "string" && validator.isPort(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsSurrogatePair from "validator/lib/isSurrogatePair"; | ||
import validator from "validator"; | ||
export const IS_SURROGATE_PAIR = "isSurrogatePair"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isSurrogatePair(value) { | ||
return typeof value === "string" && validatorJsIsSurrogatePair(value); | ||
return typeof value === "string" && validator.isSurrogatePair(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsUppercase from "validator/lib/isUppercase"; | ||
import validator from "validator"; | ||
export const IS_UPPERCASE = "isUppercase"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isUppercase(value) { | ||
return typeof value === "string" && validatorJsIsUppercase(value); | ||
return typeof value === "string" && validator.isUppercase(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsUUID from "validator/lib/isUUID"; | ||
import validator from "validator"; | ||
export const IS_UUID = "isUuid"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isUUID(value, version) { | ||
return typeof value === "string" && validatorJsIsUUID(value, version); | ||
return typeof value === "string" && validator.isUUID(value, version); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsVariableWidth from "validator/lib/isVariableWidth"; | ||
import validator from "validator"; | ||
export const IS_VARIABLE_WIDTH = "isVariableWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isVariableWidth(value) { | ||
return typeof value === "string" && validatorJsIsVariableWidth(value); | ||
return typeof value === "string" && validator.isVariableWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export const LENGTH = "length"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function length(value, min, max) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min, max }); | ||
return typeof value === "string" && validator.isLength(value, { min, max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsMatches from "validator/lib/matches"; | ||
import validator from "validator"; | ||
export const MATCHES = "matches"; | ||
@@ -10,3 +10,3 @@ /** | ||
// TODO: breaking change - vyhodene modifiers?: string | ||
return typeof value === "string" && validatorJsMatches(value, pattern); | ||
return typeof value === "string" && validator.matches(value, pattern); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export const MAX_LENGTH = "maxLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function maxLength(value, max) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min: 0, max }); | ||
return typeof value === "string" && validator.isLength(value, { min: 0, max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export const MIN_LENGTH = "minLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function minLength(value, min) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min }); | ||
return typeof value === "string" && validator.isLength(value, { min }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsContains from "validator/lib/contains"; | ||
import validator from "validator"; | ||
export const NOT_CONTAINS = "notContains"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function notContains(value, seed) { | ||
return typeof value === "string" && !validatorJsContains(value, seed); | ||
return typeof value === "string" && !validator.contains(value, seed); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "./ValidateBy"; | ||
import validatorJsIsLatLong from "validator/lib/isLatLong"; | ||
import validator from "validator"; | ||
export var IS_LATLONG = "isLatLong"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isLatLong(value) { | ||
return typeof value === "string" && validatorJsIsLatLong(value); | ||
return typeof value === "string" && validator.isLatLong(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsDivisibleBy from "validator/lib/isDivisibleBy"; | ||
import validator from "validator"; | ||
export var IS_DIVISIBLE_BY = "isDivisibleBy"; | ||
@@ -10,3 +10,3 @@ /** | ||
typeof num === "number" && | ||
validatorJsIsDivisibleBy(String(value), num); | ||
validator.isDivisibleBy(String(value), num); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsContains from "validator/lib/contains"; | ||
import validator from "validator"; | ||
export var CONTAINS = "contains"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function contains(value, seed) { | ||
return typeof value === "string" && validatorJsContains(value, seed); | ||
return typeof value === "string" && validator.contains(value, seed); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsAscii from "validator/lib/isAscii"; | ||
import validator from "validator"; | ||
export var IS_ASCII = "isAscii"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isAscii(value) { | ||
return typeof value === "string" && validatorJsIsAscii(value); | ||
return typeof value === "string" && validator.isAscii(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsBase64 from "validator/lib/isBase64"; | ||
import validator from "validator"; | ||
export var IS_BASE64 = "isBase64"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isBase64(value) { | ||
return typeof value === "string" && validatorJsIsBase64(value); | ||
return typeof value === "string" && validator.isBase64(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsBoolean from "validator/lib/isBoolean"; | ||
import validator from "validator"; | ||
export var IS_BOOLEAN_STRING = "isBooleanString"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isBooleanString(value) { | ||
return typeof value === "string" && validatorJsIsBoolean(value); | ||
return typeof value === "string" && validator.isBoolean(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJjIsByteLength from "validator/lib/isByteLength"; | ||
import validator from "validator"; | ||
export var IS_BYTE_LENGTH = "isByteLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isByteLength(value, min, max) { | ||
return typeof value === "string" && validatorJjIsByteLength(value, { min: min, max: max }); | ||
return typeof value === "string" && validator.isByteLength(value, { min: min, max: max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsCreditCard from "validator/lib/isCreditCard"; | ||
import validator from "validator"; | ||
export var IS_CREDIT_CARD = "isCreditCard"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isCreditCard(value) { | ||
return typeof value === "string" && validatorJsIsCreditCard(value); | ||
return typeof value === "string" && validator.isCreditCard(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsFullWidth from "validator/lib/isFullWidth"; | ||
import validator from "validator"; | ||
export var IS_FULL_WIDTH = "isFullWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isFullWidth(value) { | ||
return typeof value === "string" && validatorJsIsFullWidth(value); | ||
return typeof value === "string" && validator.isFullWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHalfWidth from "validator/lib/isHalfWidth"; | ||
import validator from "validator"; | ||
export var IS_HALF_WIDTH = "isHalfWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isHalfWidth(value) { | ||
return typeof value === "string" && validatorJsIsHalfWidth(value); | ||
return typeof value === "string" && validator.isHalfWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHexadecimal from "validator/lib/isHexadecimal"; | ||
import validator from "validator"; | ||
export var IS_HEXADECIMAL = "isHexadecimal"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isHexadecimal(value) { | ||
return typeof value === "string" && validatorJsIsHexadecimal(value); | ||
return typeof value === "string" && validator.isHexadecimal(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsHexColor from "validator/lib/isHexColor"; | ||
import validator from "validator"; | ||
export var IS_HEX_COLOR = "isHexColor"; | ||
@@ -10,3 +10,3 @@ /** | ||
// TODO: breaking change - https://github.com/validatorjs/validator.js/pull/1233 | ||
return typeof value === "string" && validatorJsIsHexColor(value); | ||
return typeof value === "string" && validator.isHexColor(value); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISIN from "validator/lib/isISIN"; | ||
import validator from "validator"; | ||
export var IS_ISIN = "isIsin"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isISIN(value) { | ||
return typeof value === "string" && validatorJsIsISIN(value); | ||
return typeof value === "string" && validator.isISIN(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISO31661Alpha2 from "validator/lib/isISO31661Alpha2"; | ||
import validator from "validator"; | ||
export var IS_ISO31661_ALPHA_2 = "isISO31661Alpha2"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isISO31661Alpha2(value) { | ||
return typeof value === "string" && validatorJsIsISO31661Alpha2(value); | ||
return typeof value === "string" && validator.isISO31661Alpha2(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsISO31661Alpha3 from "validator/lib/isISO31661Alpha3"; | ||
import validator from "validator"; | ||
export var IS_ISO31661_ALPHA_3 = "isISO31661Alpha3"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isISO31661Alpha3(value) { | ||
return typeof value === "string" && validatorJsIsISO31661Alpha3(value); | ||
return typeof value === "string" && validator.isISO31661Alpha3(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsJSON from "validator/lib/isJSON"; | ||
import validator from "validator"; | ||
export var IS_JSON = "isJson"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isJSON(value) { | ||
return typeof value === "string" && validatorJsIsJSON(value); | ||
return typeof value === "string" && validator.isJSON(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsJWT from "validator/lib/isJWT"; | ||
import validator from "validator"; | ||
export var IS_JWT = "isJwt"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isJWT(value) { | ||
return typeof value === "string" && validatorJsIsJWT(value); | ||
return typeof value === "string" && validator.isJWT(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLowercase from "validator/lib/isLowercase"; | ||
import validator from "validator"; | ||
export var IS_LOWERCASE = "isLowercase"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isLowercase(value) { | ||
return typeof value === "string" && validatorJsIsLowercase(value); | ||
return typeof value === "string" && validator.isLowercase(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsMatches from "validator/lib/matches"; | ||
import validator from "validator"; | ||
export var IS_MILITARY_TIME = "isMilitaryTime"; | ||
@@ -10,3 +10,3 @@ /** | ||
var militaryTimeRegex = /^([01]\d|2[0-3]):?([0-5]\d)$/; | ||
return typeof value === "string" && validatorJsMatches(value, militaryTimeRegex); | ||
return typeof value === "string" && validator.matches(value, militaryTimeRegex); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsMongoId from "validator/lib/isMongoId"; | ||
import validator from "validator"; | ||
export var IS_MONGO_ID = "isMongoId"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isMongoId(value) { | ||
return typeof value === "string" && validatorJsIsMongoId(value); | ||
return typeof value === "string" && validator.isMongoId(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsMultibyte from "validator/lib/isMultibyte"; | ||
import validator from "validator"; | ||
export var IS_MULTIBYTE = "isMultibyte"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isMultibyte(value) { | ||
return typeof value === "string" && validatorJsIsMultibyte(value); | ||
return typeof value === "string" && validator.isMultibyte(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
var phoneUtil = require("google-libphonenumber").PhoneNumberUtil.getInstance(); | ||
import { PhoneNumberUtil } from "google-libphonenumber"; | ||
export var IS_PHONE_NUMBER = "isPhoneNumber"; | ||
@@ -12,2 +12,3 @@ /** | ||
export function isPhoneNumber(value, region) { | ||
var phoneUtil = PhoneNumberUtil.getInstance(); | ||
try { | ||
@@ -14,0 +15,0 @@ var phoneNum = phoneUtil.parseAndKeepRawInput(value, region); |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsPort from "validator/lib/isPort"; | ||
import validator from "validator"; | ||
export var IS_PORT = "isPort"; | ||
@@ -8,3 +8,3 @@ /** | ||
export function isPort(value) { | ||
return typeof value === "string" && validatorJsIsPort(value); | ||
return typeof value === "string" && validator.isPort(value); | ||
} | ||
@@ -11,0 +11,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsSurrogatePair from "validator/lib/isSurrogatePair"; | ||
import validator from "validator"; | ||
export var IS_SURROGATE_PAIR = "isSurrogatePair"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isSurrogatePair(value) { | ||
return typeof value === "string" && validatorJsIsSurrogatePair(value); | ||
return typeof value === "string" && validator.isSurrogatePair(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsUppercase from "validator/lib/isUppercase"; | ||
import validator from "validator"; | ||
export var IS_UPPERCASE = "isUppercase"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isUppercase(value) { | ||
return typeof value === "string" && validatorJsIsUppercase(value); | ||
return typeof value === "string" && validator.isUppercase(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsUUID from "validator/lib/isUUID"; | ||
import validator from "validator"; | ||
export var IS_UUID = "isUuid"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isUUID(value, version) { | ||
return typeof value === "string" && validatorJsIsUUID(value, version); | ||
return typeof value === "string" && validator.isUUID(value, version); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsVariableWidth from "validator/lib/isVariableWidth"; | ||
import validator from "validator"; | ||
export var IS_VARIABLE_WIDTH = "isVariableWidth"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function isVariableWidth(value) { | ||
return typeof value === "string" && validatorJsIsVariableWidth(value); | ||
return typeof value === "string" && validator.isVariableWidth(value); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export var LENGTH = "length"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function length(value, min, max) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min: min, max: max }); | ||
return typeof value === "string" && validator.isLength(value, { min: min, max: max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsMatches from "validator/lib/matches"; | ||
import validator from "validator"; | ||
export var MATCHES = "matches"; | ||
@@ -10,3 +10,3 @@ /** | ||
// TODO: breaking change - vyhodene modifiers?: string | ||
return typeof value === "string" && validatorJsMatches(value, pattern); | ||
return typeof value === "string" && validator.matches(value, pattern); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export var MAX_LENGTH = "maxLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function maxLength(value, max) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min: 0, max: max }); | ||
return typeof value === "string" && validator.isLength(value, { min: 0, max: max }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsIsLength from "validator/lib/isLength"; | ||
import validator from "validator"; | ||
export var MIN_LENGTH = "minLength"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function minLength(value, min) { | ||
return typeof value === "string" && validatorJsIsLength(value, { min: min }); | ||
return typeof value === "string" && validator.isLength(value, { min: min }); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
import { buildMessage, ValidateBy } from "../common/ValidateBy"; | ||
import validatorJsContains from "validator/lib/contains"; | ||
import validator from "validator"; | ||
export var NOT_CONTAINS = "notContains"; | ||
@@ -9,3 +9,3 @@ /** | ||
export function notContains(value, seed) { | ||
return typeof value === "string" && !validatorJsContains(value, seed); | ||
return typeof value === "string" && !validator.contains(value, seed); | ||
} | ||
@@ -12,0 +12,0 @@ /** |
{ | ||
"name": "class-validator", | ||
"private": false, | ||
"version": "0.12.0-refactor.3", | ||
"version": "0.12.0-refactor.4", | ||
"description": "Class-based validation with Typescript / ES6 / ES5 using decorators or validation schemas. Supports both node.js and browser", | ||
@@ -9,3 +9,3 @@ "license": "MIT", | ||
"main": "./bundles/index.umd.js", | ||
"module": "./esm5/index.js", | ||
"module": "./bundles/index.esm.js", | ||
"es2015": "./esm2015/index.js", | ||
@@ -31,2 +31,5 @@ "typings": "./types/index.d.ts", | ||
], | ||
"peerDependencies": { | ||
"tslib": ">=1.9.0" | ||
}, | ||
"dependencies": { | ||
@@ -76,3 +79,4 @@ "@types/validator": "12.0.1", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"rollup-plugin-uglify": "^6.0.4", | ||
"sinon": "^8.0.0", | ||
@@ -79,0 +83,0 @@ "sinon-chai": "^3.2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
545
2078663
4
48
13709
3