functionality
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -40,2 +40,5 @@ var _ = require('lodash'); | ||
return new Masquerade(function(value) { | ||
// /regex/ => "a regex string" | ||
if(mask instanceof RegExp) return mask.test(value || ''); | ||
// String => "string" | ||
@@ -79,4 +82,2 @@ if(mask === String) return typeof value == 'string'; | ||
// /regex/ => "a regex string" | ||
if(mask instanceof RegExp) return mask.test(value || ''); | ||
@@ -83,0 +84,0 @@ // Masquerade => new Masquerade() |
{ | ||
"name": "functionality", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Simple function overloading for JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Sierra Softworks", |
@@ -115,2 +115,14 @@ var Masquerade = require('../lib/Masquerade.js'); | ||
}); | ||
it('should support RegExp masks', function() { | ||
Masquerade.match(/^str$/, "str").should.be.true; | ||
Masquerade.match(/^str$/, "astr").should.be.false; | ||
Masquerade.match(/^str$/, 1).should.be.false; | ||
Masquerade.match(/^str$/, new Date()).should.be.false; | ||
Masquerade.match(/^str$/, /regex/).should.be.false; | ||
Masquerade.match(/^str$/, []).should.be.false; | ||
Masquerade.match(/^str$/, {}).should.be.false; | ||
Masquerade.match(/^str$/, true).should.be.false; | ||
Masquerade.match(/^str$/, { a: 1 }).should.be.false; | ||
}); | ||
}); | ||
@@ -117,0 +129,0 @@ |
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
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
27714
499