🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@toolz/allow

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toolz/allow - npm Package Compare versions

Comparing version

to
1.0.7

2

package.json
{
"name": "@toolz/allow",
"version": "1.0.6",
"version": "1.0.7",
"description": "Provides validation of data types",

@@ -5,0 +5,0 @@ "keywords": [

import { isARegularObject } from '@toolz/is-a-regular-object';
export const failureBehavior = {
IGNORE: 'ignore',
THROW: 'throw',
WARN: 'warn',
};
const Allow = () => {
let allowNull = false;
let failureBehavior = 'throw';
const failureBehaviorOptions = {
ignore: 'ignore',
throw: 'throw',
warn: 'warn',
};
let currentFailureBehavior = failureBehavior.THROW;
let onFailure = () => {

@@ -167,5 +168,5 @@ //

onFailure(value, message);
if (failureBehavior === 'ignore')
if (currentFailureBehavior === 'ignore')
return allow;
if (failureBehavior === 'warn') {
if (currentFailureBehavior === 'warn') {
console.warn(value);

@@ -181,3 +182,3 @@ console.warn(`[${value.toString()}] ${message}`);

const getFailureBehavior = () => failureBehavior;
const getFailureBehavior = () => currentFailureBehavior;

@@ -216,4 +217,4 @@ const getOnFailure = () => onFailure;

const setFailureBehavior = behavior => {
oneOf(behavior, failureBehaviorOptions);
failureBehavior = behavior;
oneOf(behavior, failureBehavior);
currentFailureBehavior = behavior;
};

@@ -245,3 +246,2 @@

fail,
failureBehaviorOptions,
getAllowNull,

@@ -248,0 +248,0 @@ getFailureBehavior,