Utility function to create a specification from a predicate function
A function that returns true if the candidate satisfies the specification
Optional
A new specification wrapping the predicate
const isAdult = fromPredicate<Person>(p => p.age >= 18);const isEligible = isAdult.and(fromPredicate(p => p.hasValidId)); Copy
const isAdult = fromPredicate<Person>(p => p.age >= 18);const isEligible = isAdult.and(fromPredicate(p => p.hasValidId));
Utility function to create a specification from a predicate function