UNPKG

@envelop/core

Version:

This is the core package for Envelop. You can find a complete documentation here: https://github.com/n1ru4l/envelop

30 lines (29 loc) 870 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useEngine = void 0; const useEngine = (engine) => { return { onExecute: ({ setExecuteFn }) => { if (engine.execute) { setExecuteFn(engine.execute); } }, onParse: ({ setParseFn }) => { if (engine.parse) { setParseFn(engine.parse); } }, onValidate: ({ setValidationFn, addValidationRule }) => { if (engine.validate) { setValidationFn(engine.validate); } engine.specifiedRules?.map(addValidationRule); }, onSubscribe: ({ setSubscribeFn }) => { if (engine.subscribe) { setSubscribeFn(engine.subscribe); } }, }; }; exports.useEngine = useEngine;