data-columns
v1.0.0
Published
A column holds meta-data describing the type of data that goes in that column, along with methods to sanitize and validate it.
Downloads
30
Maintainers
Readme
Data Columns
This package contains objects to help describe columns, including the validation and sanitation for the data of those columns.
const Column = require('data-column').Column;
let column = Column.populate({
type: 'string',
name: 'first_name',
label: 'First Name',
description: 'The users first name.',
required: true,
sanitizers: [{
name: 'string'
}],
validators: [{
name: 'string',
options: {
required: true,
length: {
min: 3,
max: 24,
message: 'Your name must be in between {min} and {max} characters.'
}
}
}]
});