conform

Usage: conform(spec, x)

Given a spec and a value, returns ':node.spec/invalid' if value does not match spec, else the (possibly destructured) value.

Source

Example:

const s = require('speculaas');
const {isInteger} = s.utils;

s.def('::a', isInteger);
s.conform('::a', 12);
// 12

results matching ""

    No results matching ""