classify(key, value) {
        var thingy = this.myClasses[key]
        // * thingy might be an array containing a single element: the class
        //   that should be instantiated for each value in the array.
        // * thingy might be an object with attribute valueClass, which will
        //   be used to provide class to the value of each attribute in the
        //   object.
        // * thingy is otherwise assumed to be a class.
        if (!thingy) {
            // we do not have a class defined for this key.
            return value;
        } else if (thingy instanceof Array) {
            // This is an array of thingies.
            const klass = thingy[0];
            return value.map((obj) => {
                return new klass(obj);
            })
        } else if (thingy instanceof Object && thingy['valueClass']) {
            // This is an array of thingies.
            const klass = thingy.valueClass;
            for (var property in value) {
                value[property] = new klass(value[property]);
            }
            return value;
        } else {
            // instantiate the singular thingy.
            return new thingy(value);
        }
    }
/*
     * classify - use classes to compose objects from raw input values.
     */
use classes to compose objects from raw input values.
use classes to compose objects from raw input values .
classify(key, value) {
        var thingy = this.myClasses[key]
        if (!thingy) {
            return value;
        } else if (thingy instanceof Array) {
            const klass = thingy[0];
            return value.map((obj) => {
                return new klass(obj);
            })
        } else if (thingy instanceof Object && thingy['valueClass']) {
            const klass = thingy.valueClass;
            for (var property in value) {
                value[property] = new klass(value[property]);
            }
            return value;
        } else {
            return new thingy(value);
        }
    }
classify ( key , value ) { var thingy = this . myClasses [ key ] if ( ! thingy ) { return value ; } else if ( thingy instanceof Array ) { const klass = thingy [ 0 ] ; return value . map ( ( obj ) => { return new klass ( obj ) ; } ) } else if ( thingy instanceof Object && thingy [ 'valueClass' ] ) { const klass = thingy . valueClass ; for ( var property in value ) { value [ property ] = new klass ( value [ property ] ) ; } return value ; } else { return new thingy ( value ) ; } }
classify - use classes to compose objects from raw input values.
classify - use classes to compose objects from raw input values .
// * thingy might be an array containing a single element: the class //   that should be instantiated for each value in the array. // * thingy might be an object with attribute valueClass, which will //   be used to provide class to the value of each attribute in the //   object. // * thingy is otherwise assumed to be a class. // we do not have a class defined for this key. // This is an array of thingies. // This is an array of thingies. // instantiate the singular thingy.