src/field-creator.js
function createUnitField(data, schema) {
    data = data || [];
    let partialField;

    switch (schema.type) {
    case FieldType.MEASURE:
        switch (schema.subtype) {
        case MeasureSubtype.CONTINUOUS:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        }
    case FieldType.DIMENSION:
        switch (schema.subtype) {
        case DimensionSubtype.CATEGORICAL:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.TEMPORAL:
            partialField = new PartialField(schema.name, data, schema, new TemporalParser(schema));
            return new Temporal(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.BINNED:
            partialField = new PartialField(schema.name, data, schema, new BinnedParser());
            return new Binned(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        }
    default:
        partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
        return new Categorical(partialField, `0-${data.length - 1}`);
    }
}
function createUnitField(data, schema) {
    data = data || [];
    let partialField;

    switch (schema.type) {
    case FieldType.MEASURE:
        switch (schema.subtype) {
        case MeasureSubtype.CONTINUOUS:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new ContinuousParser());
            return new Continuous(partialField, `0-${data.length - 1}`);
        }
    case FieldType.DIMENSION:
        switch (schema.subtype) {
        case DimensionSubtype.CATEGORICAL:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.TEMPORAL:
            partialField = new PartialField(schema.name, data, schema, new TemporalParser(schema));
            return new Temporal(partialField, `0-${data.length - 1}`);
        case DimensionSubtype.BINNED:
            partialField = new PartialField(schema.name, data, schema, new BinnedParser());
            return new Binned(partialField, `0-${data.length - 1}`);
        default:
            partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
            return new Categorical(partialField, `0-${data.length - 1}`);
        }
    default:
        partialField = new PartialField(schema.name, data, schema, new CategoricalParser());
        return new Categorical(partialField, `0-${data.length - 1}`);
    }
}
function createUnitField ( data , schema ) { data = data || [ ] ; let partialField ; switch ( schema . type ) { case FieldType . MEASURE : switch ( schema . subtype ) { case MeasureSubtype . CONTINUOUS : partialField = new PartialField ( schema . name , data , schema , new ContinuousParser ( ) ) ; return new Continuous ( partialField , ` ${ data . length - 1 } ` ) ; default : partialField = new PartialField ( schema . name , data , schema , new ContinuousParser ( ) ) ; return new Continuous ( partialField , ` ${ data . length - 1 } ` ) ; } case FieldType . DIMENSION : switch ( schema . subtype ) { case DimensionSubtype . CATEGORICAL : partialField = new PartialField ( schema . name , data , schema , new CategoricalParser ( ) ) ; return new Categorical ( partialField , ` ${ data . length - 1 } ` ) ; case DimensionSubtype . TEMPORAL : partialField = new PartialField ( schema . name , data , schema , new TemporalParser ( schema ) ) ; return new Temporal ( partialField , ` ${ data . length - 1 } ` ) ; case DimensionSubtype . BINNED : partialField = new PartialField ( schema . name , data , schema , new BinnedParser ( ) ) ; return new Binned ( partialField , ` ${ data . length - 1 } ` ) ; default : partialField = new PartialField ( schema . name , data , schema , new CategoricalParser ( ) ) ; return new Categorical ( partialField , ` ${ data . length - 1 } ` ) ; } default : partialField = new PartialField ( schema . name , data , schema , new CategoricalParser ( ) ) ; return new Categorical ( partialField , ` ${ data . length - 1 } ` ) ; } }
Creates a field instance according to the provided data and schema.

@param {Array} data - The field data array.
@param {Object} schema - The field schema object.
@return {Field} Returns the newly created field instance.
Creates a field instance according to the provided data and schema .