directions.js 650 B

123456789101112131415161718192021222324252627282930
  1. const moving_directions = Object.freeze({
  2. front: "front",
  3. back: "back",
  4. left: "left",
  5. right: "right",
  6. stop: "stop"
  7. });
  8. const rotating_directions = Object.freeze({
  9. clockwise: "clockwise",
  10. counterclockwise: "counterclockwise",
  11. top: "top",
  12. bottom: "bottom",
  13. stop: "stop"
  14. });
  15. const is_moving_direction = (target) => {
  16. return Object.values(moving_directions).includes(target);
  17. }
  18. const is_rotating_direction = (target) => {
  19. return Object.values(rotating_directions).includes(target);
  20. }
  21. export {
  22. moving_directions,
  23. is_moving_direction,
  24. rotating_directions,
  25. is_rotating_direction
  26. };