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.9.0 to 3.10.0

17

lib/index.js

@@ -1109,2 +1109,18 @@ 'use strict';

/**
* Create a validator that checks that the tested object contains at least one
* of the specified keys.
*/
function hasAtLeastOneKey(requiredKeys) {
const requiredSet = new Set(requiredKeys);
return makeValidator({
test: (value, state) => {
const keys = Object.keys(value);
const valid = keys.some(key => requiredSet.has(key));
if (!valid)
return pushError(state, `Missing at least one property from ${getPrintableArray(Array.from(requiredSet), `or`)}`);
return true;
},
});
}
/**
* Create a validator that checks that the tested object contains none of the

@@ -1195,2 +1211,3 @@ * specified keys.

exports.fn = fn;
exports.hasAtLeastOneKey = hasAtLeastOneKey;
exports.hasExactLength = hasExactLength;

@@ -1197,0 +1214,0 @@ exports.hasForbiddenKeys = hasForbiddenKeys;

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

/**
* Create a validator that checks that the tested object contains at least one
* of the specified keys.
*/
export declare function hasAtLeastOneKey(requiredKeys: string[]): import("../types").LooseValidator<Record<string, unknown>, Record<string, unknown>>;
/**
* Create a validator that checks that the tested object contains none of the

@@ -36,0 +41,0 @@ * specified keys.

2

package.json
{
"name": "typanion",
"version": "3.9.0",
"version": "3.10.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