Advertisement
raqystyle

Possible way to map string -> option (html tag)

Dec 2nd, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(glob) {
  2.  
  3.   var stringToOption = R.compose(
  4.     R.map(function(x) {
  5.       return {
  6.         v: x,
  7.         el: mkElem('option')
  8.       };
  9.     }),
  10.     R.map(function(p) {
  11.       p.el = setElemValue(p.v, p.el);
  12.       return p;
  13.     }),
  14.     R.map(function(p) {
  15.       return setText(p.v, p.el);
  16.     })
  17.   );
  18.  
  19.   // listToOptions :: String -> HTMLOptionElement
  20.   glob.listToOptions = R.into([], stringToOption);
  21.  
  22. })(window);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement