Home Reference Source
import Type from 'formatron/src/types/type.js'
public class | source

Type

Direct Subclass:

DataType, ViewType

The base type that all view and data types inherit from. This provides basic parsing functionality that can be overriden and used by the child types.

Static Member Summary

Static Public Members
public static

The type name.

Static Method Summary

Static Public Methods
public static

parse(field: object | Immutable.Map, parseField: function): Type

Parses a JS or Immutable.js object into a type.

public static

parseOneOrMany(parseField: func): oneOrManyParser

Creates a one or many parser with the passed in field parser.

public static

parseOptions(field: Immutable.Map, parseField: function): Immutable.Map

Override this function if you want the type to reference other types.

Static Public Members

public static typeName: * source

The type name. This must be overridden so that the type can be registered.

Static Public Methods

public static parse(field: object | Immutable.Map, parseField: function): Type source

Parses a JS or Immutable.js object into a type.

Params:

NameTypeAttributeDescription
field object | Immutable.Map

The field to parse.

parseField function

A function to parse child types.

Return:

Type

The newly instantiated type.

public static parseOneOrMany(parseField: func): oneOrManyParser source

Creates a one or many parser with the passed in field parser.

Params:

NameTypeAttributeDescription
parseField func

The field parsing functon to use.

Return:

oneOrManyParser

The parser function. Can be used in .map, etc.

public static parseOptions(field: Immutable.Map, parseField: function): Immutable.Map source

Override this function if you want the type to reference other types.

Params:

NameTypeAttributeDescription
field Immutable.Map

The field to parse.

parseField function

A function to parse a child type.

Return:

Immutable.Map

The modified field object.