Ein Projekt das es ermöglicht Beerpong über das Internet von zwei unabhängigen positionen aus zu spielen. Entstehung im Rahmen einer Praktikumsaufgabe im Fach Interaktion.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.js 898B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 'use strict';
  2. /**
  3. * Merge `b` into `a`.
  4. *
  5. * @param {Object} a
  6. * @param {Object} b
  7. * @return {Object}
  8. * @api public
  9. */
  10. exports.merge = function(a, b) {
  11. for (var key in b) a[key] = b[key];
  12. return a;
  13. };
  14. exports.walkAST = function walkAST(ast, before, after) {
  15. before && before(ast);
  16. switch (ast.type) {
  17. case 'Block':
  18. ast.nodes.forEach(function (node) {
  19. walkAST(node, before, after);
  20. });
  21. break;
  22. case 'Case':
  23. case 'Each':
  24. case 'Mixin':
  25. case 'Tag':
  26. case 'When':
  27. case 'Code':
  28. ast.block && walkAST(ast.block, before, after);
  29. break;
  30. case 'Attrs':
  31. case 'BlockComment':
  32. case 'Comment':
  33. case 'Doctype':
  34. case 'Filter':
  35. case 'Literal':
  36. case 'MixinBlock':
  37. case 'Text':
  38. break;
  39. default:
  40. throw new Error('Unexpected node type ' + ast.type);
  41. break;
  42. }
  43. after && after(ast);
  44. };