Framework

- About
- Guides
- Community
- API
- Code
- Download

# Kanso API Documentation

Index | View on single page

## validators

Validation functions used to validate Field contents.

### min(min)

Tests that the field's value is greater than 'min'.

#### Parameters

min | Number |

Returns: Function

### max(max)

Tests that the field's value is less than 'max'

#### Parameters

max | Number |

Returns: Function

### range(min, max)

Tests that the field's value is greater than 'min' AND less than 'max'

#### Parameters

min | Number |
max | Number |

Returns: Function

### minlength(val)

Tests that the field's value length is greater than 'val'

#### Parameters

val | Number |

Returns: Function

### maxlength(val)

Tests that the field's value length is less than 'val'

#### Parameters

val | Number |

Returns: Function

### rangelength(min, max)

Tests that the field's value length is greater than 'min' AND less than 'max'

#### Parameters

min | Number |
max | Number |

Returns: Function

### regexp(re, message)

Tests field's value against a regular expression

#### Parameters

re | RegExp | can be a string or RegExp object
message | String | (optional) a custom error message to throw

Returns: Function

### email()

Tests that field's value is a valid email address using a regular expression.

Returns: Function

### url()

Tests that field's value is a valid URL using a regular expression.

Returns: Function

### missingIDs()

Detects embedded documents with missing _id properties and returns an array of Error objects for each occurence. Returns an empty array if all documents have a populated _id property.

Used by the EmbeddedList field type.

#### Parameters

doc | Object |
value | Array |

Returns: Array