"use strict"; const combinator = require("./"); const { validateValue } = require("@validatem/core"); const isString = require("@validatem/is-string"); function createPassthroughCombinator(rules) { // This is a dummy combinator that just applies the rules to the value (with the given context) as-normal. You could add any custom logic in here on when/how to apply validators, how to interpret the input rules/arguments of the factory function (if any), how to post-process the errors, and so on. You may want to look at some real combinators (`has-shape`, `array-of`, `dynamic`, `when`, etc.) to see some more realistic examples of how to effectively use this API. return combinator((value, applyValidators, context) => { return applyValidators(value, rules, context); }); }; let result = validateValue("fourty-two", createPassthroughCombinator([ isString ])); console.log(result); // fourty-two