Socket
Socket
Sign inDemoInstall

@toolz/allow

Package Overview
Dependencies
1
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 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,

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc