hashtd

swagger dropdown fix

Nov 27th, 2020
618
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let options = document.querySelectorAll('option');
  2.  
  3. let optionRegx = /=\s(\d)$/;
  4.  
  5. for(let o of options) {
  6.     if(o.value && o.value.length > 0) {
  7.         let matches = o.value.match(optionRegx);
  8.         console.log(matches);
  9.         if(matches && typeof matches[1] !== 'undefined') {
  10.             o.value = matches[1];
  11.         }
  12.     }
  13. }
RAW Paste Data