import {Configuration} from './Configuration';
import {TrueConfiguration} from './TrueConfiguration';
import {FalseConfiguration} from './FalseConfiguration';

export class JSONConfiguration implements Configuration {
    constructor(private config: Object) {
    }

    public isFieldMandatory(name: string): boolean {
        var value = this.getValue(name);
        return typeof value === 'undefined' || !!value;
    }

    private getValue(name: string): any {
        if (typeof name !== 'string' || name.length === 0) {
            return null;
        }

        return this.config[name];
    }

    public getConfigFor(name: string): Configuration {
        var value = this.getValue(name);
        if (value === true || typeof value === 'undefined') {
            return new TrueConfiguration();
        } else if (!value) {
            return new FalseConfiguration();
        } else {
            return new JSONConfiguration(value);
        }
    }
}

import {Configuration} from './Configuration';
import {TrueConfiguration} from './TrueConfiguration';
import {FalseConfiguration} from './FalseConfiguration';

export class JSONConfiguration implements Configuration {
    constructor(private config: Object) {
    }

    public isFieldMandatory(name: string): boolean {
        var value = this.getValue(name);
        return !!value;
    }

    private getValue(name: string): any {
        if (typeof name !== 'string' || name.length === 0) {
            return null;
        }

        return this.config[name];
    }

    public getConfigFor(name: string): Configuration {
        var value = this.getValue(name);
        if (value === true) {
            return new TrueConfiguration();
        } else if (!value) {
            return new FalseConfiguration();
        } else {
            return new JSONConfiguration(value);
        }
    }
}

--- 
+++ 
@@ -8,7 +8,7 @@
 
     public isFieldMandatory(name: string): boolean {
         var value = this.getValue(name);
-        return !!value;
+        return typeof value === 'undefined' || !!value;
     }
 
     private getValue(name: string): any {
@@ -21,7 +21,7 @@
 
     public getConfigFor(name: string): Configuration {
         var value = this.getValue(name);
-        if (value === true) {
+        if (value === true || typeof value === 'undefined') {
             return new TrueConfiguration();
         } else if (!value) {
             return new FalseConfiguration();
Make configuration true by default
