Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arc-check

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc-check - npm Package Compare versions

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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc