ffield
Small Node.js library for creating and validating data fields.
API
ffield
ffield~FIELD_TYPE
Field data types.
Kind: inner constant of ffield
ffield~JS_TYPE
Representation of native JS types.
Kind: inner constant of ffield
ffield~objHasVal(obj, val) ⇒ boolean
Checks if specified object has a property
with the specified value.
Kind: inner method of ffield
ffield~fieldTypeToJsType(fieldType) ⇒ string
Convert field type to native js type.
Kind: inner method of ffield
ffield~validateField(field, fieldValidator)
Validate a field object.
Kind: inner method of ffield
Param | Type | Description |
---|
field | Object | Field object to validate. |
fieldValidator | function | Functional field validator. (true = valid) |
ffield~createField(fieldType, fieldData)
Create a field object.
Native js type of fieldData must match equivalent
fieldType.
Kind: inner method of ffield
Param | Type | Default | Description |
---|
fieldType | string | | Field's data type. |
fieldData | * |
| Field's data content. |
ffield~updateField(field, newData) ⇒ Object
Update the data of a field object.
(Performs validation on updated field object too.)
Kind: inner method of ffield
Returns: Object
- Updated field object.
Param | Type | Default | Description |
---|
field | Object | | Field object to update. |
newData | * |
| New data to apply to field object. |
ffield~cloneField(field) ⇒ Object
Clone a field object.
(Performs validation on cloned field object too.)
Kind: inner method of ffield
Returns: Object
- Cloned field object.
Param | Type | Description |
---|
field | Object | Field object to clone. |