@bytesoftio/schema
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Array
Schema
Boolean
Schema
Date
Schema
Mixed
Schema
Number
Schema
Object
Schema
Schema
String
Schema
constructor
conditional
Validation
Definitions
immutable
Mode
sanitizer
Definitions
validation
Definitions
add
Conditional
Validation
Definition
add
Sanitizer
Definition
add
Validation
Definition
alpha
alpha
Dashes
alpha
Numeric
alpha
Numeric
Dashes
alpha
Numeric
Underscores
alpha
Underscores
also
and
between
clone
clone
Instance
custom
Sanitize
Behavior
custom
Sanitize
Behavior
Async
custom
Testing
Behavior
custom
Testing
Behavior
Async
custom
Validation
Behavior
custom
Validation
Behavior
Async
date
date
After
date
After
OrSame
date
Before
date
Before
OrSame
date
Between
date
Between
OrSame
date
Time
email
ends
With
equals
includes
length
map
matches
max
min
none
Of
numeric
omits
one
Of
optional
or
remove
Validation
Definitions
OfType
required
sanitize
sanitize
And
Test
sanitize
And
Test
Async
sanitize
And
Validate
sanitize
And
Validate
Async
sanitize
Async
sanitizer
skip
Clone
starts
With
test
test
Async
time
time
After
time
After
OrSame
time
Before
time
Before
OrSame
time
Between
time
Between
OrSame
to
Camel
Case
to
Capitalized
to
Constant
Case
to
Default
to
Kebab
Case
to
Lower
Case
to
Snake
Case
to
Trimmed
to
Upper
Case
url
validate
validate
Async
validator
Validation
Schema
Custom
Validation
Custom
Validation
Message
Custom
Validation
Result
Lazy
Value
Maybe
Promise
Object
Shape
Sanitizer
Definition
Sanitizer
Function
Validation
Block
Validation
Definition
Validation
Error
Validation
Function
Validation
Function
Result
Validation
Link
Validation
Path
Validation
Result
Validation
Type
schema
Translator
array
boolean
create
Validation
Result
date
mixed
number
object
string
value
Hierarchy
Schema
<
string
>
StringSchema
Implements
ValidationSchema
<
string
>
Index
Constructors
constructor
Properties
conditional
Validation
Definitions
immutable
Mode
sanitizer
Definitions
validation
Definitions
Methods
add
Conditional
Validation
Definition
add
Sanitizer
Definition
add
Validation
Definition
alpha
alpha
Dashes
alpha
Numeric
alpha
Numeric
Dashes
alpha
Numeric
Underscores
alpha
Underscores
also
and
between
clone
clone
Instance
custom
Sanitize
Behavior
custom
Sanitize
Behavior
Async
custom
Testing
Behavior
custom
Testing
Behavior
Async
custom
Validation
Behavior
custom
Validation
Behavior
Async
date
date
After
date
After
OrSame
date
Before
date
Before
OrSame
date
Between
date
Between
OrSame
date
Time
email
ends
With
equals
includes
length
map
matches
max
min
none
Of
numeric
omits
one
Of
optional
or
remove
Validation
Definitions
OfType
required
sanitize
sanitize
And
Test
sanitize
And
Test
Async
sanitize
And
Validate
sanitize
And
Validate
Async
sanitize
Async
sanitizer
skip
Clone
starts
With
test
test
Async
time
time
After
time
After
OrSame
time
Before
time
Before
OrSame
time
Between
time
Between
OrSame
to
Camel
Case
to
Capitalized
to
Constant
Case
to
Default
to
Kebab
Case
to
Lower
Case
to
Snake
Case
to
Trimmed
to
Upper
Case
url
validate
validate
Async
validator
Constructors
constructor
new
String
Schema
(
)
:
StringSchema
Returns
StringSchema
Properties
Protected
conditional
Validation
Definitions
conditional
Validation
Definitions
:
ValidationDefinition
[]
= []
Protected
immutable
Mode
immutable
Mode
:
boolean
= true
Protected
sanitizer
Definitions
sanitizer
Definitions
:
SanitizerDefinition
[]
= []
Protected
validation
Definitions
validation
Definitions
:
ValidationDefinition
[]
= []
Methods
Protected
add
Conditional
Validation
Definition
add
Conditional
Validation
Definition
(
validationDefinition
:
ValidationDefinition
)
:
this
Parameters
validationDefinition:
ValidationDefinition
Returns
this
Protected
add
Sanitizer
Definition
add
Sanitizer
Definition
(
sanitizerDefinition
:
SanitizerDefinition
)
:
this
Parameters
sanitizerDefinition:
SanitizerDefinition
Returns
this
Protected
add
Validation
Definition
add
Validation
Definition
(
validationDefinition
:
ValidationDefinition
)
:
this
Parameters
validationDefinition:
ValidationDefinition
Returns
this
alpha
alpha
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
alpha
Dashes
alpha
Dashes
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
alpha
Numeric
alpha
Numeric
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
alpha
Numeric
Dashes
alpha
Numeric
Dashes
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
alpha
Numeric
Underscores
alpha
Numeric
Underscores
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
alpha
Underscores
alpha
Underscores
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
also
also
(
validator
:
CustomValidation
)
:
this
Parameters
validator:
CustomValidation
Returns
this
and
and
(
andValidator
:
CustomValidation
)
:
this
Parameters
andValidator:
CustomValidation
Returns
this
between
between
(
minLength
:
LazyValue
<
number
>
, maxLength
:
LazyValue
<
number
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
minLength:
LazyValue
<
number
>
maxLength:
LazyValue
<
number
>
Optional
message:
CustomValidationMessage
Returns
this
Protected
clone
clone
(
)
:
this
Returns
this
Protected
clone
Instance
clone
Instance
(
)
:
this
Returns
this
Protected
custom
Sanitize
Behavior
custom
Sanitize
Behavior<TValue, TSanitizedValue>
(
value
:
TValue
)
:
TSanitizedValue
Type parameters
TValue
TSanitizedValue
Parameters
value:
TValue
Returns
TSanitizedValue
Protected
custom
Sanitize
Behavior
Async
custom
Sanitize
Behavior
Async<TValue, TSanitizedValue>
(
value
:
TValue
)
:
Promise
<
TSanitizedValue
>
Type parameters
TValue
TSanitizedValue
Parameters
value:
TValue
Returns
Promise
<
TSanitizedValue
>
Protected
custom
Testing
Behavior
custom
Testing
Behavior
(
value
:
any
, testResult
:
boolean
)
:
boolean
Parameters
value:
any
testResult:
boolean
Returns
boolean
Protected
custom
Testing
Behavior
Async
custom
Testing
Behavior
Async
(
value
:
any
, testResult
:
boolean
)
:
Promise
<
boolean
>
Parameters
value:
any
testResult:
boolean
Returns
Promise
<
boolean
>
Protected
custom
Validation
Behavior
custom
Validation
Behavior
(
value
:
any
, errors
:
ValidationError
[]
)
:
ValidationError
[]
Parameters
value:
any
errors:
ValidationError
[]
Returns
ValidationError
[]
Protected
custom
Validation
Behavior
Async
custom
Validation
Behavior
Async
(
value
:
any
, errors
:
ValidationError
[]
)
:
Promise
<
ValidationError
[]
>
Parameters
value:
any
errors:
ValidationError
[]
Returns
Promise
<
ValidationError
[]
>
date
date
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
date
After
date
After
(
after
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
After
OrSame
date
After
OrSame
(
after
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
Before
date
Before
(
before
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
before:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
Before
OrSame
date
Before
OrSame
(
before
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
before:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
Between
date
Between
(
after
:
LazyValue
<
Date
>
, before
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
Date
>
before:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
Between
OrSame
date
Between
OrSame
(
after
:
LazyValue
<
Date
>
, before
:
LazyValue
<
Date
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
Date
>
before:
LazyValue
<
Date
>
Optional
message:
CustomValidationMessage
Returns
this
date
Time
date
Time
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
email
email
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
ends
With
ends
With
(
find
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
find:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
equals
equals
(
equal
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
equal:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
includes
includes
(
find
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
find:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
length
length
(
exactLength
:
LazyValue
<
number
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
exactLength:
LazyValue
<
number
>
Optional
message:
CustomValidationMessage
Returns
this
map
map
(
sanitizer
:
SanitizerFunction
)
:
this
Parameters
sanitizer:
SanitizerFunction
Returns
this
matches
matches
(
regex
:
LazyValue
<
RegExp
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
regex:
LazyValue
<
RegExp
>
Optional
message:
CustomValidationMessage
Returns
this
max
max
(
maxLength
:
LazyValue
<
number
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
maxLength:
LazyValue
<
number
>
Optional
message:
CustomValidationMessage
Returns
this
min
min
(
minLength
:
LazyValue
<
number
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
minLength:
LazyValue
<
number
>
Optional
message:
CustomValidationMessage
Returns
this
none
Of
none
Of
(
blacklist
:
LazyValue
<
string
[]
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
blacklist:
LazyValue
<
string
[]
>
Optional
message:
CustomValidationMessage
Returns
this
numeric
numeric
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
omits
omits
(
find
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
find:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
one
Of
one
Of
(
whitelist
:
LazyValue
<
string
[]
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
whitelist:
LazyValue
<
string
[]
>
Optional
message:
CustomValidationMessage
Returns
this
optional
optional
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
or
or
(
orValidator
:
CustomValidation
)
:
this
Parameters
orValidator:
CustomValidation
Returns
this
Protected
remove
Validation
Definitions
OfType
remove
Validation
Definitions
OfType
(
type
:
ValidationType
)
:
this
Parameters
type:
ValidationType
Returns
this
required
required
(
required
?:
LazyValue
<
boolean
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
required:
LazyValue
<
boolean
>
Optional
message:
CustomValidationMessage
Returns
this
sanitize
sanitize<TValue, TSanitizedValue>
(
value
:
TValue
)
:
TSanitizedValue
Type parameters
TValue
TSanitizedValue
Parameters
value:
TValue
Returns
TSanitizedValue
sanitize
And
Test
sanitize
And
Test<TValue, TSanitizedValue>
(
value
:
any
)
:
[
boolean
,
TSanitizedValue
]
Type parameters
TValue
TSanitizedValue
Parameters
value:
any
Returns
[
boolean
,
TSanitizedValue
]
sanitize
And
Test
Async
sanitize
And
Test
Async<TValue, TSanitizedValue>
(
value
:
any
)
:
Promise
<
[
boolean
,
TSanitizedValue
]
>
Type parameters
TValue
TSanitizedValue
Parameters
value:
any
Returns
Promise
<
[
boolean
,
TSanitizedValue
]
>
sanitize
And
Validate
sanitize
And
Validate<TValue, TSanitizedValue>
(
value
:
any
)
:
[
ValidationError
[]
|
undefined
,
TSanitizedValue
]
Type parameters
TValue
TSanitizedValue
Parameters
value:
any
Returns
[
ValidationError
[]
|
undefined
,
TSanitizedValue
]
sanitize
And
Validate
Async
sanitize
And
Validate
Async<TValue, TSanitizedValue>
(
value
:
any
)
:
Promise
<
[
ValidationError
[]
|
undefined
,
TSanitizedValue
]
>
Type parameters
TValue
TSanitizedValue
Parameters
value:
any
Returns
Promise
<
[
ValidationError
[]
|
undefined
,
TSanitizedValue
]
>
sanitize
Async
sanitize
Async<TValue, TSanitizedValue>
(
value
:
TValue
)
:
Promise
<
TSanitizedValue
>
Type parameters
TValue
TSanitizedValue
Parameters
value:
TValue
Returns
Promise
<
TSanitizedValue
>
sanitizer
sanitizer
(
sanitizer
:
SanitizerFunction
)
:
this
Parameters
sanitizer:
SanitizerFunction
Returns
this
Protected
skip
Clone
skip
Clone
(
fn
:
(
)
=>
void
)
:
void
Parameters
fn:
(
)
=>
void
(
)
:
void
Returns
void
Returns
void
starts
With
starts
With
(
find
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
find:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
test
test
(
value
:
any
)
:
boolean
Parameters
value:
any
Returns
boolean
test
Async
test
Async
(
value
:
any
)
:
Promise
<
boolean
>
Parameters
value:
any
Returns
Promise
<
boolean
>
time
time
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
time
After
time
After
(
after
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
time
After
OrSame
time
After
OrSame
(
after
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
time
Before
time
Before
(
before
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
before:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
time
Before
OrSame
time
Before
OrSame
(
before
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
before:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
time
Between
time
Between
(
after
:
LazyValue
<
string
>
, before
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
string
>
before:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
time
Between
OrSame
time
Between
OrSame
(
after
:
LazyValue
<
string
>
, before
:
LazyValue
<
string
>
, message
?:
CustomValidationMessage
)
:
this
Parameters
after:
LazyValue
<
string
>
before:
LazyValue
<
string
>
Optional
message:
CustomValidationMessage
Returns
this
to
Camel
Case
to
Camel
Case
(
)
:
this
Returns
this
to
Capitalized
to
Capitalized
(
)
:
this
Returns
this
to
Constant
Case
to
Constant
Case
(
)
:
this
Returns
this
to
Default
to
Default
(
defaultValue
?:
LazyValue
<
string
>
)
:
this
Parameters
Default value
defaultValue:
LazyValue
<
string
>
= ""
Returns
this
to
Kebab
Case
to
Kebab
Case
(
)
:
this
Returns
this
to
Lower
Case
to
Lower
Case
(
)
:
this
Returns
this
to
Snake
Case
to
Snake
Case
(
)
:
this
Returns
this
to
Trimmed
to
Trimmed
(
)
:
this
Returns
this
to
Upper
Case
to
Upper
Case
(
)
:
this
Returns
this
url
url
(
message
?:
CustomValidationMessage
)
:
this
Parameters
Optional
message:
CustomValidationMessage
Returns
this
validate
validate
(
value
:
any
)
:
ValidationError
[]
|
undefined
Parameters
value:
any
Returns
ValidationError
[]
|
undefined
validate
Async
validate
Async
(
value
:
any
)
:
Promise
<
ValidationError
[]
|
undefined
>
Parameters
value:
any
Returns
Promise
<
ValidationError
[]
|
undefined
>
validator
validator
(
validator
:
CustomValidation
)
:
this
Parameters
validator:
CustomValidation
Returns
this