# Class: CoreType
param
of field in schema
param
name of type
param
param
flag to define if the field is mandatory
param
that will be applied to the field, allowed function, object or string with the name of the custom validator
param
that will define the initial value of the field, this option allows a value or a function
param
that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict
# Hierarchy
-
↳ CoreType
↳ DateType
# Constructors
# Protected
constructor
+ new CoreType(name
: string, typeName
: string, options?
: CoreTypeOptions): CoreType
Overrides IOttomanType.constructor
Parameters:
Name | Type |
---|---|
name | string |
typeName | string |
options? | CoreTypeOptions |
Returns: CoreType
# Properties
# name
• name: string
Inherited from IOttomanType.name
# Optional
options
• options? : CoreTypeOptions
# typeName
• typeName: string
Inherited from IOttomanType.typeName
# Static
sName
▪ sName: any
# Accessors
# default
• get default(): unknown
Returns: unknown
# required
• get required(): boolean | RequiredOption | RequiredFunction
Returns: boolean | RequiredOption | RequiredFunction
# validator
• get validator(): ValidatorOption | ValidatorFunction | string | undefined
Returns: ValidatorOption | ValidatorFunction | string | undefined
# Methods
# buildDefault
▸ buildDefault(): unknown
Returns: unknown
# Abstract
cast
▸ cast(value
: unknown, strategy?
: CAST_STRATEGY): unknown
Inherited from IOttomanType.cast
Parameters:
Name | Type |
---|---|
value | unknown |
strategy? | CAST_STRATEGY |
Returns: unknown
# checkRequired
▸ checkRequired(): string | void
Returns: string | void
# checkValidator
▸ checkValidator(value
: unknown): void
Parameters:
Name | Type |
---|---|
value | unknown |
Returns: void
# isEmpty
▸ isEmpty(value
: unknown): boolean
Parameters:
Name | Type |
---|---|
value | unknown |
Returns: boolean
# isStrictStrategy
▸ isStrictStrategy(strategy
: VALIDATION_STRATEGY): boolean
Parameters:
Name | Type |
---|---|
strategy | VALIDATION_STRATEGY |
Returns: boolean
# validate
▸ validate(value
: unknown, strict
: boolean): unknown
Overrides IOttomanType.validate
Parameters:
Name | Type | Default |
---|---|---|
value | unknown | - |
strict | boolean | true |
Returns: unknown