@darkwolf/validator
Advanced tools
Comparing version 2.0.3 to 2.0.4
18
index.js
@@ -85,2 +85,6 @@ class Validator { | ||
_isObjectExact(value) { | ||
return Object.prototype.toString.call(value) === '[object Object]' | ||
} | ||
_isExists(value) { | ||
@@ -126,2 +130,6 @@ return !this._isUndefined(value) && !this._isNull(value) | ||
_isRegex(value, regex) { | ||
return regex.test(value) | ||
} | ||
_valid(callback) { | ||
@@ -209,2 +217,7 @@ if (this._isUndefined(this.isValid) || this.isValid) { | ||
isObjectExact(...args) { | ||
if (args.length) return this._isObjectExact(...args) | ||
return this._valid(() => this._isObjectExact(this.value)) | ||
} | ||
isExists(...args) { | ||
@@ -259,4 +272,9 @@ if (args.length) return this._isExists(...args) | ||
} | ||
isRegex(...args) { | ||
if (args.length > 1) return this._isRegex(...args) | ||
return this._valid(() => this._isRegex(this.value, ...args)) | ||
} | ||
} | ||
module.exports = new Validator() |
{ | ||
"name": "@darkwolf/validator", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Validator Utility", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -44,2 +44,3 @@ # Validator Utility | ||
### isSet(value?) | ||
### isObjectExact(value?) | ||
### isExists(value?) | ||
@@ -49,7 +50,8 @@ ### isNaN(value?) | ||
### isInfinity(value?) | ||
### isMore(value?) | ||
### isLess(value?) | ||
### isEqual(value?) | ||
### isMoreEqual(value?) | ||
### isLessEqual(value?) | ||
### isMore(value?, number) | ||
### isLess(value?, number) | ||
### isEqual(value?, number) | ||
### isMoreEqual(value?, number) | ||
### isLessEqual(value?, number) | ||
### isRange(value?, min, max) | ||
### isRegex(value?, regex) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9440
216
56
0