validator
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -12,2 +12,15 @@ var entities = require('./entities'); | ||
Filter.prototype.wrap = function (str) { | ||
return str; | ||
} | ||
Filter.prototype.value = function () { | ||
return this.str; | ||
} | ||
Filter.prototype.chain = function () { | ||
this.wrap = function () { return this }; | ||
return this; | ||
} | ||
//Create some aliases - may help code readability | ||
@@ -21,3 +34,3 @@ Filter.prototype.convert = Filter.prototype.sanitize = function(str) { | ||
this.modify(xss.clean(this.str, is_image)); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -27,3 +40,3 @@ | ||
this.modify(entities.decode(this.str)); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -33,3 +46,3 @@ | ||
this.modify(entities.encode(this.str)); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -40,3 +53,3 @@ | ||
this.modify(this.str.replace(new RegExp('^['+chars+']+', 'g'), '')); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -47,3 +60,3 @@ | ||
this.modify(this.str.replace(new RegExp('['+chars+']+$', 'g'), '')); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -54,3 +67,3 @@ | ||
this.modify(this.str.replace(new RegExp('^['+chars+']+|['+chars+']+$', 'g'), '')); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -62,3 +75,3 @@ | ||
} | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -68,3 +81,3 @@ | ||
this.modify(parseFloat(this.str)); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -75,3 +88,3 @@ | ||
this.modify(parseInt(this.str, radix)); | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -87,3 +100,3 @@ | ||
} | ||
return this.str; | ||
return this.wrap(this.str); | ||
} | ||
@@ -99,3 +112,3 @@ | ||
} | ||
return this.str; | ||
return this.wrap(this.str); | ||
} |
{ "name" : "validator", | ||
"description" : "Data validation, filtering and sanitization for node.js", | ||
"version" : "0.2.8", | ||
"version" : "0.2.9", | ||
"homepage" : "http://github.com/chriso/node-validator", | ||
@@ -5,0 +5,0 @@ "keywords" : ["validator", "validation", "assert", "params", "sanitization", "xss", "entities", "sanitize", "sanitisation", "input"], |
@@ -133,3 +133,8 @@ var node_validator = require('../lib'), | ||
assert.equal('[removed] foobar', Filter.sanitize('j a vasc ri pt: foobar').xss()); | ||
}, | ||
'test chaining': function () { | ||
assert.equal('&', Filter.sanitize('&').chain().entityEncode().entityEncode().entityEncode().value()); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
105274
2245
0
2