Comparing version 2.1.0 to 2.2.0
@@ -35,3 +35,3 @@ /*! | ||
VERSION: '2.1.0', | ||
VERSION: '2.2.0', | ||
@@ -206,6 +206,2 @@ // OPERATORS | ||
regex: function(x) { | ||
return Object.prototype.toString.call(x) == '[object RegExp]' | ||
}, | ||
/** | ||
@@ -242,3 +238,25 @@ * Is the subject an arguments object? | ||
// REGULAR EXPRESSIONS | ||
/** | ||
* Is the subject a regular expression? | ||
* | ||
* @method regex | ||
* @param {RegEx} subject, required | ||
*/ | ||
regex: function(x) { | ||
return Object.prototype.toString.call(x) == '[object RegExp]' | ||
}, | ||
/** | ||
* Does the subject match the provided regular expression? | ||
* | ||
* @method match | ||
* @param {String} subject, required | ||
* @param {RegExp} standard, required | ||
*/ | ||
match: function(x, rx) { | ||
return is.rx(rx) && rx.test(x) | ||
}, | ||
// STRINGS | ||
@@ -245,0 +263,0 @@ |
{ | ||
"name": "is-too", | ||
"description": "simple validations", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "is", |
var asserts = require('./_asserts') | ||
var assert = require('assert') | ||
var is = require('../is-too') | ||
var regexs = ['regex', 'newRegExp'] | ||
var rx = /foo/ | ||
@@ -15,2 +18,11 @@ describe('regular expressions', function(){ | ||
it('is.match', function(){ | ||
assert.equal(true, is.match('foo', rx)) | ||
}) | ||
it('is.not.match', function(){ | ||
assert.equal(true, is.not.match('bar', rx)) | ||
assert.equal(true, is.not.match(new Date(), rx)) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
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
49748
1666
1