src/util.js
/**
 * Validates and parses a path
 * @param {string|string[]} p The path to parse.
 * May also be a list of paths. The paths will be joined and used as one pathString
 * @param {boolean} withStats Indicates whether or not to verify if the path exists
 */
Validates and parses a path
@param {string|string[]} p The path to parse.
May also be a list of paths. The paths will be joined and used as one pathString
@param {boolean} withStats Indicates whether or not to verify if the path exists
Validates and parses a path @param { string|string [] } p The path to parse . May also be a list of paths . The paths will be joined and used as one pathString @param { boolean } withStats Indicates whether or not to verify if the path exists
function vpath(p, withStats = false) {
  try {
    let stats = null;
    const pathString = Array.isArray(p) ? path.join(...p) : p;
    if (withStats) stats = fs.statSync(pathString);
    return {
      ...path.parse(pathString),
      stats,
      full: pathString,
      concat: (...paths) => path.join(pathString, ...paths)
    };
  } catch (error) {
    throw error;
  }
}
function vpath ( p , withStats = false ) { try { let stats = null ; const pathString = Array . isArray ( p ) ? path . join ( ... p ) : p ; if ( withStats ) stats = fs . statSync ( pathString ) ; return { ... path . parse ( pathString ) , stats , full : pathString , concat : ( ... paths ) => path . join ( pathString , ... paths ) } ; } catch ( error ) { throw error ; } }
Validates and parses a path
 @param {string|string[]} p The path to parse.
Validates and parses a path @param { string|string [] } p The path to parse .