@appliedblockchain/assert-combinators
Advanced tools
Comparing version 5.6.0 to 5.6.1
# Changelog | ||
## [v5.6.1](../../compare/v5.6.0...v5.6.1) (2023-10-05) | ||
* Fix(or): fixing typing for `or`. | ||
* Updating changelog. | ||
## [v5.6.0](../../compare/v5.5.0...v5.6.0) (2022-12-14) | ||
@@ -4,0 +9,0 @@ |
@@ -1,3 +0,3 @@ | ||
import type { Assert } from './prelude.js'; | ||
declare const or: <T extends Assert<unknown>[]>(...as: T) => T[number]; | ||
import type { Assert, Asserted } from './prelude.js'; | ||
declare const or: <As extends Assert<unknown>[]>(...as: As) => (value: unknown) => Asserted<As[number]>; | ||
export default or; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util_1 = require("util"); | ||
const or = (...as) => value => { | ||
const or = (...as) => (value) => { | ||
for (const a of as) { | ||
@@ -6,0 +6,0 @@ try { |
@@ -23,1 +23,2 @@ /** Helper no-op, parametric type to expand intellisense for alias types. */ | ||
export type OptionalIfUndefined<T> = Omit<T, keyof OptionalIfUndefinedOnly<T>> & OptionalIfUndefinedOnly<T>; | ||
export type IntersectionOfUnion<T> = (T extends unknown ? (_: T) => unknown : never) extends (_: infer R) => unknown ? R : never; |
@@ -1,3 +0,3 @@ | ||
import type { Assert } from './prelude.js'; | ||
declare const or: <T extends Assert<unknown>[]>(...as: T) => T[number]; | ||
import type { Assert, Asserted } from './prelude.js'; | ||
declare const or: <As extends Assert<unknown>[]>(...as: As) => (value: unknown) => Asserted<As[number]>; | ||
export default or; |
import { inspect } from 'util'; | ||
const or = (...as) => value => { | ||
const or = (...as) => (value) => { | ||
for (const a of as) { | ||
@@ -4,0 +4,0 @@ try { |
@@ -23,1 +23,2 @@ /** Helper no-op, parametric type to expand intellisense for alias types. */ | ||
export type OptionalIfUndefined<T> = Omit<T, keyof OptionalIfUndefinedOnly<T>> & OptionalIfUndefinedOnly<T>; | ||
export type IntersectionOfUnion<T> = (T extends unknown ? (_: T) => unknown : never) extends (_: infer R) => unknown ? R : never; |
{ | ||
"name": "@appliedblockchain/assert-combinators", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"description": "Assertion combinators.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1,10 +0,10 @@ | ||
import type { Assert } from './prelude.js' | ||
import type { Assert, Asserted } from './prelude.js' | ||
import { inspect } from 'util' | ||
const or: <T extends Assert<unknown>[]>(...as: T) => T[number] = | ||
(...as) => | ||
value => { | ||
const or = | ||
<As extends Assert<unknown>[]>(...as: As) => | ||
(value: unknown) => { | ||
for (const a of as) { | ||
try { | ||
return a(value) | ||
return a(value) as Asserted<As[number]> | ||
} catch (err) { | ||
@@ -11,0 +11,0 @@ continue |
@@ -74,1 +74,4 @@ /** Helper no-op, parametric type to expand intellisense for alias types. */ | ||
Omit<T, keyof OptionalIfUndefinedOnly<T>> & OptionalIfUndefinedOnly<T> | ||
export type IntersectionOfUnion<T> = | ||
(T extends unknown ? (_: T) => unknown : never) extends (_: infer R) => unknown ? R : never |
Sorry, the diff of this file is not supported yet
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
183469
3063