DataSchema Utility: Enforcing DataTypes
DataSchema supports a parser property that enforces type conversion on data as the schema is being applied. The parser property can point to one of the following types of parsing functions:
- A DataType subclass parse function, like
Y.DataType.Number.parse - A registered shortcut to a DataType subclass parse function, like
"number" - A custom function
Use the parser property in your schema's resultFields definition to point to a parsing function. Parsing your data in this manner is essential if your numerical or date data comes over the wire as JSON, since all the values will be strings.
