Guest User

Untitled

a guest
Jan 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. puts = function(str, tags) {
  2. var items, localPuts, output, outputs, rootnode, tag, text, _ref;
  3. localPuts = function(firstElement) {
  4. var elem1, func, rootnode;
  5. elem1 = document.createElement(firstElement);
  6. rootnode = document.body.appendChild(elem1);
  7. func = function(tagId) {
  8. return function(textobj) {
  9. var elem, textnode;
  10. elem = document.createElement(tagId);
  11. textnode = textobj.appendChild(elem);
  12. return textnode;
  13. };
  14. };
  15. return [func, rootnode];
  16. };
  17. _ref = localPuts("p"), outputs = _ref[0], rootnode = _ref[1];
  18. items = (function() {
  19. var _i, _len, _results;
  20. _results = [];
  21. for (_i = 0, _len = tags.length; _i < _len; _i++) {
  22. tag = tags[_i];
  23. _results.push(outputs(tag));
  24. }
  25. return _results;
  26. })();
  27.  
  28. alert(items[1]);
  29. output = _.compose.apply(null, items);
  30. text = output(rootnode);
  31. return text.innerHTML = str;
  32. };
  33. }).call(this);
Add Comment
Please, Sign In to add comment