DigitalMag

fp via js

May 9th, 2021 (edited)
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // const IF = a => f => a && f(a);
  2. var IF = (b, a) => f => b && f(a || b);
  3. // var If = (b, a) => f1 => f0 => (b ? f1 : f0)(a);
  4. const If = (a, fb) => f1 => f0 => (b => b ? f1(b) : f0(a))(fb(a));        
  5.  
  6. // 1:        
  7. let id = defaultId || If([].slice.call(eventRow.children[1].querySelectorAll('a'), 0, -1), a => a.reverse()[1])(a => a.href)(ar => ar[0].href);  
  8.    
  9. // 2:
  10. let id;
  11. if (defaultId) id = defaultId
  12. else{
  13.     let arr = [].slice.call(eventRow.children[1].querySelectorAll('a'), 0, -1);
  14.  
  15.     let a = arr.reverse()[1]      
  16.     id = a ? a.href : arr[0] .href;            
  17. }
Add Comment
Please, Sign In to add comment