Node.js 458 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. class Node {
  7. constructor(name, parent) {
  8. this.name = name;
  9. this.parent = parent;
  10. }
  11. get path() {
  12. const path = [];
  13. let node = this;
  14. while (node) {
  15. path.push(node.name);
  16. node = node.parent;
  17. }
  18. return path.reverse().join('/');
  19. }
  20. get isRoot() {
  21. return !this.parent;
  22. }
  23. }
  24. exports.default = Node;
  25. ;