Skip to content
Advertisement

Create a customer converter and validator using ATTRS

I am trying to learn attrs and I have two questions. Please note that I am using the ATTRS library, not ATTR.

  1. How do I create a converter to change typ to uppercase? —> I solved this question. The formula below is updated. :)
  2. How do I create a validator to ensure that typ is contained within a list?

I’ve tried many things on both, but to no avail. The documentation does not show how to make either a custom converter or validator- or, at least, I do not understand if it does.

JavaScript

Thank you in advance!

Advertisement

Answer

For whomever needs it, here is the answer.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement