Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 315 Bytes

predicatesSpecs.md

File metadata and controls

17 lines (11 loc) · 315 Bytes

Specifying values using predicates

Use pred passing it the predicate you want to use to check the values:

import s from "./speco";

const isEven = (n) => {return n%2 === 0;}

const predicatesSpec = s.pred(isEven)

s.isValid(predicatesSpec, 1);
// => false

s.isValid(predicatesSpec, 2);
// => true