UNPKG

@degjs/form-validation

Version:

A modular form validation plugin, free of third-party dependencies and built on top of native HTML5 validation.

25 lines (21 loc) 421 B
import scrollTo from "@degjs/scroll-to"; const logError = (msg = '', el = null, level = 'log') => { const msgPrefix = 'formValidation: '; console[level](msgPrefix + msg); if (el !== null) { console[level](el); } } const scrollToError = (errorEl, speed, easing) => { if (errorEl) { scrollTo({ element: errorEl, duration: speed, easing: easing }); } } export { logError, scrollToError };