Class: default<TType, TContext, TOut>
yup.default
Type parameters​
Name | Type |
---|---|
TType | extends Maybe <string > = string | undefined |
TContext | extends AnyObject = AnyObject |
TOut | extends TType = TType |
Hierarchy​
BaseSchema
<TType
,TContext
,TOut
>↳
default
Constructors​
constructor​
• new default<TType
, TContext
, TOut
>()
Type parameters​
Name | Type |
---|---|
TType | extends Maybe <string > = undefined | string |
TContext | extends AnyObject = AnyObject |
TOut | extends Maybe <string > = TType |
Overrides​
Properties​
__inputType​
• Readonly
__inputType: TType
Inherited from​
__isYupSchema__​
• Readonly
__isYupSchema__: boolean
Inherited from​
__outputType​
• Readonly
__outputType: TOut
Inherited from​
_blacklist​
• Protected
_blacklist: default
Inherited from​
_whitelist​
• Protected
_whitelist: default
Inherited from​
deps​
• Readonly
deps: readonly string
[]
Inherited from​
equals​
• equals: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
exclusiveTests​
• Protected
exclusiveTests: Record
<string
, boolean
>
Inherited from​
is​
• is: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
nope​
• nope: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
not​
• not: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
spec​
• spec: SchemaSpec
<any
>
Inherited from​
tests​
• tests: Test
[]
Inherited from​
transforms​
• transforms: TransformFunction
<AnySchema
<any
, any
, any
>>[]
Inherited from​
type​
• Readonly
type: string
Inherited from​
Accessors​
_type​
• get
_type(): string
Returns​
string
Inherited from​
BaseSchema._type
Methods​
_cast​
â–¸ Protected
_cast(rawValue
, _options
): any
Parameters​
Name | Type |
---|---|
rawValue | any |
_options | CastOptions <TContext > |
Returns​
any
Inherited from​
_getDefault​
â–¸ Protected
_getDefault(): any
Returns​
any
Inherited from​
_isPresent​
â–¸ Protected
_isPresent(value
): boolean
Parameters​
Name | Type |
---|---|
value | any |
Returns​
boolean
Overrides​
_typeCheck​
â–¸ Protected
_typeCheck(value
): value is NonNullable<TType>
Parameters​
Name | Type |
---|---|
value | any |
Returns​
value is NonNullable<TType>
Overrides​
_validate​
â–¸ Protected
_validate(_value
, options
, cb
): void
Parameters​
Name | Type |
---|---|
_value | any |
options | undefined | InternalOptions <TContext > |
cb | Callback <any > |
Returns​
void
Inherited from​
cast​
â–¸ cast(value
, options?
): TType
Parameters​
Name | Type |
---|---|
value | any |
options? | CastOptions <TContext > |
Returns​
TType
Inherited from​
clone​
â–¸ clone(spec?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
spec? | Partial <SchemaSpec <any >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
concat​
â–¸ concat<TOther
>(schema
): TOther
Type parameters​
Name | Type |
---|---|
TOther | extends default <any , any , any , TOther > |
Parameters​
Name | Type |
---|---|
schema | TOther |
Returns​
TOther
Inherited from​
default​
â–¸ default<D
>(def
): If
<D
, default
<undefined
| TType
, TContext
, undefined
| TType
>, default
<Defined
<TType
>, TContext
, Defined
<TType
>>>
Type parameters​
Name | Type |
---|---|
D | extends Maybe <string > |
Parameters​
Name | Type |
---|---|
def | Thunk <D > |
Returns​
If
<D
, default
<undefined
| TType
, TContext
, undefined
| TType
>, default
<Defined
<TType
>, TContext
, Defined
<TType
>>>
Inherited from​
defined​
â–¸ defined(msg?
): DefinedStringSchema
<TType
, TContext
>
Parameters​
Name | Type |
---|---|
msg? | Message <{}> |
Returns​
DefinedStringSchema
<TType
, TContext
>
Inherited from​
describe​
â–¸ describe(): SchemaDescription
Returns​
SchemaDescription
Inherited from​
desiredCurrency​
â–¸ desiredCurrency(min
, minMessage
): default
<TType
, TContext
, TType
>
Parameters​
Name | Type |
---|---|
min | string |
minMessage | string |
Returns​
default
<TType
, TContext
, TType
>
email​
â–¸ email(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{ regex : RegExp }> |
Returns​
default
<TType
, TContext
, TOut
>
emptyAsUndefined​
â–¸ emptyAsUndefined(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
ensure​
â–¸ ensure(): default
<NonNullable
<TType
>, AnyObject
, NonNullable
<TType
>>
Returns​
default
<NonNullable
<TType
>, AnyObject
, NonNullable
<TType
>>
ether​
â–¸ ether(min
, minMessage
, maxMessage
): default
<TType
, TContext
, TType
>
Parameters​
Name | Type |
---|---|
min | string |
minMessage | string |
maxMessage | string |
Returns​
default
<TType
, TContext
, TType
>
ethereumAddress​
â–¸ ethereumAddress(message
): default
<TType
, TContext
, TType
>
Parameters​
Name | Type |
---|---|
message | string |
Returns​
default
<TType
, TContext
, TType
>
getDefault​
â–¸ getDefault(options?
): TType
Parameters​
Name | Type |
---|---|
options? | ResolveOptions <any > |
Returns​
TType
Inherited from​
isType​
â–¸ isType(v
): boolean
Parameters​
Name | Type |
---|---|
v | any |
Returns​
boolean
Inherited from​
isValid​
â–¸ isValid(value
, options?
): Promise
<boolean
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<boolean
>
Inherited from​
isValidSync​
â–¸ isValidSync(value
, options?
): value is TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
value is TOut
Inherited from​
label​
â–¸ label(label
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
label | string |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
length​
â–¸ length(length
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
length | number | default <number > |
message? | Message <{ length : number }> |
Returns​
default
<TType
, TContext
, TOut
>
lowercase​
â–¸ lowercase(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
matches​
â–¸ matches(regex
, options?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
regex | RegExp |
options? | MatchOptions | Message <{ regex : RegExp }> |
Returns​
default
<TType
, TContext
, TOut
>
max​
â–¸ max(max
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
max | number | default <number > |
message? | Message <{ max : number }> |
Returns​
default
<TType
, TContext
, TOut
>
meta​
â–¸ meta(): undefined
| Record
<string
, unknown
>
Returns​
undefined
| Record
<string
, unknown
>
Inherited from​
â–¸ meta(obj
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
obj | Record <string , unknown > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
min​
â–¸ min(min
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
min | number | default <number > |
message? | Message <{ min : number }> |
Returns​
default
<TType
, TContext
, TOut
>
notOneOf​
â–¸ notOneOf<U
>(enums
, message?
): default
<TType
, TContext
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <string > |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
notRequired​
â–¸ notRequired(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
Inherited from​
nullable​
â–¸ nullable(isNullable?
): default
<null
| TType
, TContext
, null
| TType
>
Parameters​
Name | Type |
---|---|
isNullable? | true |
Returns​
default
<null
| TType
, TContext
, null
| TType
>
Inherited from​
â–¸ nullable(isNullable
): default
<Exclude
<TType
, null
>, TContext
, Exclude
<TType
, null
>>
Parameters​
Name | Type |
---|---|
isNullable | false |
Returns​
default
<Exclude
<TType
, null
>, TContext
, Exclude
<TType
, null
>>
Inherited from​
oneOf​
â–¸ oneOf<U
>(enums
, message?
): default
<TType
, TContext
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <string > |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
optional​
â–¸ optional(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
Inherited from​
required​
â–¸ required(msg?
): RequiredStringSchema
<TType
, TContext
>
Parameters​
Name | Type |
---|---|
msg? | Message <{}> |
Returns​
RequiredStringSchema
<TType
, TContext
>
Inherited from​
resolve​
â–¸ resolve(options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
options | ResolveOptions <any > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
strict​
â–¸ strict(isStrict?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
isStrict? | boolean |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
strip​
â–¸ strip(strip?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
strip? | boolean |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
test​
â–¸ test(options
): default
<TType
, TContext
, TOut
>
Adds a test function to the schema's queue of tests. tests can be exclusive or non-exclusive.
- exclusive tests, will replace any existing tests of the same name.
- non-exclusive: can be stacked
If a non-exclusive test is added to a schema with an exclusive test of the same name the exclusive test is removed and further tests of the same name will be stacked.
If an exclusive test is added to a schema with non-exclusive tests of the same name the previous tests are removed and further tests of the same name will replace each other.
Parameters​
Name | Type |
---|---|
options | TestConfig <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(name
, test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(name
, message
, test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
message | Message <{}> |
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
transform​
â–¸ transform(fn
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
fn | TransformFunction <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
trim​
â–¸ trim(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
typeError​
â–¸ typeError(message
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
uppercase​
â–¸ uppercase(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
url​
â–¸ url(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{ regex : RegExp }> |
Returns​
default
<TType
, TContext
, TOut
>
uuid​
â–¸ uuid(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{ regex : RegExp }> |
Returns​
default
<TType
, TContext
, TOut
>
validate​
â–¸ validate(value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<TOut
>
Inherited from​
validateAt​
â–¸ validateAt(path
, value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<TOut
>
Inherited from​
validateSync​
â–¸ validateSync(value
, options?
): TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
TOut
Inherited from​
validateSyncAt​
â–¸ validateSyncAt(path
, value
, options?
): TOut
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <TContext > |
Returns​
TOut
Inherited from​
when​
â–¸ when(options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
options | ConditionOptions <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ when(keys
, options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
keys | string | string [] |
options | ConditionOptions <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
withContext​
â–¸ withContext<TNextContext
>(): default
<Exclude
<TType
, null
>, TNextContext
, Exclude
<TType
, null
>>
Type parameters​
Name | Type |
---|---|
TNextContext | extends AnyObject |
Returns​
default
<Exclude
<TType
, null
>, TNextContext
, Exclude
<TType
, null
>>
withMutation​
â–¸ withMutation<T
>(fn
): T
Type parameters​
Name |
---|
T |
Parameters​
Name | Type |
---|---|
fn | (schema : default <TType , TContext , TOut >) => T |
Returns​
T