[intro]     [up]

Class CustomParser

Extends Class: Parser

A parser that uses custom functions to parse / format data.

Example
function doFormat(value) {
    switch (value) {
        case 0: return "low";
        case 1: return "high";
        default: return "unknown";
    }
}
function doParse(value) {
    switch (value) {
        case "low": return 0;
        case "high": return 1;
        default: return -1;
    }
}
var parser = new CustomParser(doFormat, doParse);
alert(parser.format(0)); //Result is "low"
alert(parser.parse("ABC")); //Result is -1
alert(parser.parse("high")); //Result is 1


Constructor Arguments
Name Type Default Description
formatFunction Function   The function called to format data. The data is passed as function argument
parseFunction Function   The function called to parse data. The data is passed as function argument

Properties
formatFunction The function called to format data
parseFunction The function called to parse data



Properties
formatFunction
The function called to format data. The data is passed as function argument
parseFunction
The function called to parse data. The data is passed as function argument