code: function createDir(pathArg) {
    const { dir, ext } = path.parse(pathArg);
    const dirNames = (ext === '')
      ? pathArg.split(path.sep)
      : dir.split(pathArg.sep);
  
    dirNames.reduce((accumDir, currentdir) => {
      const jointDir = path.join(accumDir, currentdir);
      if (!fs.existsSync(jointDir)) {
        fs.mkdirSync(jointDir);
      }
      return jointDir;
    }, '');
  }
docs: Iteratively creates directories to the file or directory
  @param pathArg