Regular expression will be matched vs. law name.
Input LawSet, but includes only laws with names matching re
.
import {equivalenceLaws, filterLaws, tinyInteger} from 'effect-ts-laws'
import {Number as NU, pipe} from 'effect'
// Extract reflexivity law from equivalence laws.
const reflexivity = pipe(
{a: tinyInteger, equalsA: NU.Equivalence, F: NU.Equivalence},
equivalenceLaws<number>,
filterLaws(/reflexivity/),
)
assert.equal(reflexivity.laws.length, 1)
assert.equal(reflexivity.laws[0]?.name, 'reflexivity')
Filter the laws that are direct children of a LawSet by matching a regular expression on the law name, and return the new filtered LawSet. LawSets that survive the filter remain untouched.
Useful when you need to remove from a LawSet laws that are problematic perhaps because they are slow or difficult to generate.