/**
 * Program: regex directive
 * Author: SDL
 * Description: Constraint through Regular Equation
 */
/* eslint-disable no-unused-vars */
export default {
  beforeMount(el, binding) {
    el.addEventListener('keyup', () => {
      const regex = new RegExp(binding.value);
      if (!regex.test(el.value)) {
        el.value = el.value.slice(0, -1);
      }
    });
  },
};
