http.IncomingMessage.prototype.filter = function (param) {
	var self = this,
		filter = new Filter();
	filter.modify = function (str) {
		this.str = str;
		self.params[param] = str; //Replace the param with the filtered version
	};
	return filter.sanitize(this.params[param]);
};
 req.filter = function(param) {
   var self = this;
   var filter = new Filter();
   filter.modify = function(str) {
     this.str = str;
     self.updateParam(param, str); // Replace the param with the filtered version
   };
   return filter.sanitize(this.param(param));
 };
 return this.add(function (value) {
   if (Array.isArray(value)) {
     return value;
   } else {
     return FilterPrototype[name].apply(externalFilter.sanitize(value), args);
   }
 });
Example #4
0
    function norm(value, type)
    {
        if (type == 'string')
        {
            return filter.sanitize(value).trim();
        }
        if (type == 'number')
        {
            return filter.sanitize(value).toInt();
        }
        if (type == 'boolean')
        {
            return filter.sanitize(value).toBoolean();
        }
        if (type == 'Date')
        {
            var date = new Date(value);
            if (_util.isDate(date)) return date;
        }

        return value;
    }
Example #5
0
 stack.unshift(function (value) {
   if (object.isString(value)) {
     return FilterPrototype.trim.apply(externalFilter.sanitize(value));
   }
   return value;
 });
Example #6
0
 return this.add(function (value) {
   var a = FilterPrototype[name].apply(externalFilter.sanitize(value), args);
   return a;
 });
Example #7
0
 return this.add( function ( val ){
   return FilterPrototype[ name ].
     apply( externalFilter.sanitize( val ), args );
 });