switch.js 476 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. switch (node && node.type) {
  2. case "Property":
  3. case "MethodDefinition":
  4. prop = node.key;
  5. break;
  6. case "MemberExpression":
  7. prop = node.property;
  8. break;
  9. // no default
  10. }
  11. switch (foo) {
  12. case "bar":
  13. doThing()
  14. // no default
  15. }
  16. switch (foo) {
  17. case "bar": //comment
  18. doThing(); //comment
  19. case "baz":
  20. doOtherThing(); //comment
  21. }
  22. switch (foo) {
  23. case "bar": {
  24. doThing();
  25. } //comment
  26. case "baz": {
  27. doThing();
  28. } //comment
  29. }