code: function segments(filepath) {
    const parsed = path.parse(filepath);
    const dirWithoutRoot = parsed.dir.substring(parsed.root.length);
  
    return dirWithoutRoot
      .split(path.sep)
      .concat(parsed.name)
      .reverse();
  }
docs: Given a file C:/path/to/file/on/filesystem.js - remove extension - strip filesystem root - return path segments, starting from the tail and working backwards segments('C:/path/to/file/on/filesystem.js') === ['filesystem', 'on', 'file', 'to', 'path']