Comparing version 3.2.1 to 3.3.0
@@ -135,3 +135,5 @@ type BoundCoercionFn = () => BoundCoercionFn; | ||
} | ||
declare const hasKeyRelationship: (subject: string, relationship: KeyRelationship, others: string[]) => LooseValidator<{ | ||
declare const hasKeyRelationship: (subject: string, relationship: KeyRelationship, others: string[], { ignore, }?: { | ||
ignore?: any[] | undefined; | ||
}) => LooseValidator<{ | ||
[key: string]: unknown; | ||
@@ -138,0 +140,0 @@ }, { |
@@ -374,6 +374,7 @@ 'use strict'; | ||
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { | ||
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) | ||
return pushError(state, `Unbound coercion result`); | ||
if (context.value !== value) | ||
if (context.value !== value) { | ||
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) | ||
return pushError(state, `Unbound coercion result`); | ||
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, context.value)]); | ||
} | ||
(_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions); | ||
@@ -623,3 +624,4 @@ } | ||
}; | ||
const hasKeyRelationship = (subject, relationship, others) => { | ||
const hasKeyRelationship = (subject, relationship, others, { ignore = [], } = {}) => { | ||
const skipped = new Set(ignore); | ||
const otherSet = new Set(others); | ||
@@ -630,7 +632,7 @@ const spec = keyRelationships[relationship]; | ||
const keys = new Set(Object.keys(value)); | ||
if (!keys.has(subject)) | ||
if (!keys.has(subject) || skipped.has(value[subject])) | ||
return true; | ||
const problems = []; | ||
for (const key of otherSet) | ||
if (keys.has(key) !== spec.expect) | ||
if ((keys.has(key) && !skipped.has(value[key])) !== spec.expect) | ||
problems.push(key); | ||
@@ -637,0 +639,0 @@ if (problems.length >= 1) |
{ | ||
"name": "typanion", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"main": "lib/index", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68537
1480