Newer
Older
alert / js / node_modules / webpack-bundle-analyzer / lib / tree / Node.js
@Réz István Réz István on 18 Nov 2021 458 bytes first commit
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

class Node {
  constructor(name, parent) {
    this.name = name;
    this.parent = parent;
  }

  get path() {
    const path = [];
    let node = this;

    while (node) {
      path.push(node.name);
      node = node.parent;
    }

    return path.reverse().join('/');
  }

  get isRoot() {
    return !this.parent;
  }

}

exports.default = Node;
;