Home Reference Source Test Repository
import {Legitimate} from 'legitimate/lib/Legitimate.js'
public class | source

Legitimate

Test:

Constructor Summary

Public Constructor
public

constructor(locales: *, initialState: *)

Member Summary

Public Members
public get
public get
public get

Method Summary

Public Methods
public

Validate all

public

setRules(prop: *, rulesToAdd: *): Legitimate

Sets validation functions for given prop

public

update(prop: *, value: *): Legitimate

Updates the state by given prop and value

public

validate(prop: *): Promise<*>

Triggers defined rules for prop

Public Constructors

public constructor(locales: *, initialState: *) source

Params:

NameTypeAttributeDescription
locales *

{object} [param=defaultLocales]

initialState *

{object} [initialState={}]

Test:

Public Members

public get locales: object source

Properties:

NameTypeAttributeDescription
locales *

Test:

public get rules: object source

Properties:

NameTypeAttributeDescription
rules *

Test:

public get state: object source

Properties:

NameTypeAttributeDescription
state *

Test:

Public Methods

public isLegit(): Promise<*> source

Validate all

Return:

Promise<*>

public setRules(prop: *, rulesToAdd: *): Legitimate source

Sets validation functions for given prop

Params:

NameTypeAttributeDescription
prop *
rulesToAdd *

Return:

Legitimate

Test:

public update(prop: *, value: *): Legitimate source

Updates the state by given prop and value

Params:

NameTypeAttributeDescription
prop *

{string}

value *

{*}

Return:

Legitimate

Test:

public validate(prop: *): Promise<*> source

Triggers defined rules for prop

Params:

NameTypeAttributeDescription
prop *

Return:

Promise<*>

Test: