Class: PartialField

PartialField(name, data, schema)

The base class for every field type. It provides some common functionalities.

Constructor

new PartialField(name, data, schema)

Sets basic setups to each Field instance.
Parameters:
Name Type Description
name string The name or identifier of the field.
data Array The data array.
schema Object The schema of the data type.
Source:

Methods

clone(data) → {PartialField}

Creates brand new copy of current field instance. To avoid optimization issue pass the required data otherwise current data would be copied which might be expensive.
Parameters:
Name Type Description
data Array The input data, if provided current data will not be cloned.
Source:
Returns:
Returns the cloned field instance.
Type
PartialField

description() → {description}

Source:
Returns:
Name of the field
Type
description

(abstract) domain()

Generates and returns the domain for the field.
Source:

fieldName() → {string}

Source:
Returns:
Name of the field
Type
string

(abstract) parse()

Parse the input value before using.
Source:

parsed(val) → {*}

The post parsing hook for field instance.
Parameters:
Name Type Description
val * The value to be parsed.
Source:
Returns:
Returns the parsed value.
Type
*

sanitize() → {PartialField}

Sanitizes the field data.
Source:
Returns:
- Returns the instance of the current context for chaining.
Type
PartialField

type() → {string}

Source:
Returns:
Type of the field
Type
string