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

typanion

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

typanion - npm Package Compare versions

Comparing version 3.10.0 to 3.11.0

12

lib/index.js

@@ -1143,2 +1143,8 @@ 'use strict';

}
const checks = {
missing: (keys, key) => keys.has(key),
undefined: (keys, key, value) => keys.has(key) && typeof value[key] !== `undefined`,
nil: (keys, key, value) => keys.has(key) && value[key] != null,
falsy: (keys, key, value) => keys.has(key) && !!value[key],
};
/**

@@ -1148,4 +1154,6 @@ * Create a validator that checks that the tested object contains at most one

*/
function hasMutuallyExclusiveKeys(exclusiveKeys) {
function hasMutuallyExclusiveKeys(exclusiveKeys, options) {
var _a;
const exclusiveSet = new Set(exclusiveKeys);
const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];
return makeValidator({

@@ -1156,3 +1164,3 @@ test: (value, state) => {

for (const key of exclusiveSet)
if (keys.has(key))
if (check(keys, key, value))
used.push(key);

@@ -1159,0 +1167,0 @@ if (used.length > 1)

5

lib/predicates/helperPredicates.d.ts

@@ -47,2 +47,3 @@ import { AnyStrictValidator, InferType, LooseTest, StrictTest, StrictValidator } from '../types';

}>;
export declare type MissingType = 'missing' | 'undefined' | 'nil' | 'falsy';
/**

@@ -52,3 +53,5 @@ * Create a validator that checks that the tested object contains at most one

*/
export declare function hasMutuallyExclusiveKeys(exclusiveKeys: string[]): import("../types").LooseValidator<{
export declare function hasMutuallyExclusiveKeys(exclusiveKeys: string[], options?: {
missingIf: MissingType;
}): import("../types").LooseValidator<{
[key: string]: unknown;

@@ -55,0 +58,0 @@ }, {

{
"name": "typanion",
"version": "3.10.0",
"version": "3.11.0",
"main": "lib/index",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

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