Newer
Older
alert / js / node_modules / webpack-bundle-analyzer / src / tree / Node.js
@Réz István Réz István on 18 Nov 2021 342 bytes first commit
export default 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;
  }

};