define([], function(){
    return function(type, value, oldValue)
    {
        if (type === 'array') {
            try {
                value = JSON.parse(value);
            } catch (e) {
                value = oldValue;
            }
        }else if(type === 'number')
        {
            value = parseInt(value);
        }else if(type === 'boolean')
        { // noinspection EqualityComparisonWithCoercionJS
            value = value == true || value == "true";
        }
        return value;
    };
});