var Status = function (status){
    this.status = status;
};
Status.prototype = {
    isSuccess: function (){
        return this.status == 'success';
    },
    
    isError: function (){
        return this.status == 'error';
    },
    
    isParseError: function (){
        return this.status == 'parseerror';
    }
    
    
};
'success error parse-error abort timeout'.split(' ').forEach(function (status){
    
    
    
    var name = ('is-'+status).replace(/-([a-z])/ig, function(all, letter){ return letter.toUpperCase(); });
    
    
    status = status.replace(/-/g, '');
    
    
    Status.prototype[name] = function (){
        return this.status == status;
    };
});
$.each('success error parse-error abort timeout'.split(' '), function (i, status){
    var name = $.camelCase('is-'+status);
    status = status.replace(/-/g, '');
    Status.prototype[name] = function (){
        return this.status == status;
    };
});
(new Status('success')).isSuccess(); 
(new Status('error')).isParseError(); 
var statusMap = {
      'success': 200
    , 'error': function (code){ return code != 200 }
    , 'not-found': 404
    , '500': 500
    
};
Object.keys(statusMap).forEach(function (status){
    
    var name = $.camelCase('is-'+status);
    status = statusMap[status];
    Status.prototype[name] = function (){
        return $.isFunction(status)
            ? status.call(this, this.status)
            : this.status == status
        ;
    };
});
                              
(new Status(404)).isNotFound(); 
(new Status(500)).is500();