Comparing version 1.1.0 to 1.2.0
28
index.js
const is = require('arc-is'); | ||
const ArcArray = require('arc-array'); | ||
const ArcObject = require('arc-object'); | ||
@@ -11,6 +9,6 @@ class ArcCheck{ | ||
reset(){ | ||
this.includes = new ArcObject; | ||
this.excludes = new ArcObject; | ||
this.iCallbacks = new ArcArray; | ||
this.xCallbacks = new ArcArray; | ||
this.includes = {}; | ||
this.excludes = {}; | ||
this.iCallbacks = []; | ||
this.xCallbacks = []; | ||
} | ||
@@ -58,7 +56,8 @@ | ||
//If we have inclusion regX we set it to false and check it first | ||
if(this.includes.count()){ | ||
if(Object.keys(this.includes).length){ | ||
includeCheck = false; | ||
if(is(_string) === 'string'){ | ||
this.includes.forEach(function(_RX){ | ||
let rxResult = _RX.exec(_string); | ||
Object.keys(this.includes).forEach((_key)=>{ | ||
const RX = this.includes[_key]; | ||
const rxResult = RX.exec(_string); | ||
if(is(rxResult) === 'array' && rxResult[0] !== ''){ | ||
@@ -73,3 +72,3 @@ includeCheck = true; | ||
//We will be in 2 states at this point, we will have inclusionCallbacks and we will have not done RegX inclusion checks, or the RegX inclusion checks will have failed. If so, check | ||
if(this.iCallbacks.length && !this.includes.count() || this.iCallbacks.length && !includeCheck){ | ||
if(this.iCallbacks.length && !Object.keys(this.includes).length || this.iCallbacks.length && !includeCheck){ | ||
iCallbackCheck = false; | ||
@@ -87,7 +86,8 @@ this.iCallbacks.forEach(function(_callback){ | ||
if(includeCheck && iCallbackCheck){ | ||
if(this.excludes.count()){ | ||
if(Object.keys(this.excludes).length){ | ||
//Our exclusion check is set to true initially (by default) | ||
if(is(_string) === 'string'){ | ||
this.excludes.forEach(function(_RX){ | ||
let rxResult = _RX.exec(_string); | ||
Object.keys(this.excludes).forEach((_key)=>{ | ||
const RX = this.excludes[_key]; | ||
const rxResult = RX.exec(_string); | ||
if(is(rxResult) === 'array' && rxResult[0] !== ''){ | ||
@@ -103,3 +103,3 @@ //If it matches, we want to fail the check (return false) | ||
//Again we have two states, we have exclusionCallbacks and have not done any RegX exclusion checks, or the RegX exclusion checks will have passed and we need to also check against these | ||
if(this.xCallbacks.length && !this.excludes.count() || this.xCallbacks.length && excludeCheck){ | ||
if(this.xCallbacks.length && !Object.keys(this.excludes).length || this.xCallbacks.length && excludeCheck){ | ||
//Default xCallback check is true | ||
@@ -106,0 +106,0 @@ this.xCallbacks.forEach(function(_callback){ |
{ | ||
"name": "arc-check", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An ES6 class to evaluate values against multiple complex inclusion/exclusion rules", | ||
@@ -23,5 +23,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"arc-array": "^4.0.1", | ||
"arc-is": "1.0.5", | ||
"arc-object": "^2.0.0" | ||
"arc-is": "1.0.5" | ||
}, | ||
@@ -28,0 +26,0 @@ "devDependencies": { |
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
1
11490
- Removedarc-array@^4.0.1
- Removedarc-object@^2.0.0
- Removedarc-array@4.0.14.3.1(transitive)
- Removedarc-check@1.2.0(transitive)
- Removedarc-is@1.0.8(transitive)
- Removedarc-object@2.1.0(transitive)
- Removeddeepcopy@0.6.3(transitive)