File: src/lib/joinPath.js

Recommend this page to a friend!
  Classes of Dom Hastings  >  JS Webdav Client  >  src/lib/joinPath.js  >  Download  
File: src/lib/joinPath.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: JS Webdav Client
Access files of a Webdav server
Author: By
Last change:
Date: 1 month ago
Size: 216 bytes
 

Contents

Class file image Download
export const trimSlashes = (piece) => piece.replace(/^\/+|\/+$/g, '');

export const joinPath = (...pieces) => {
  return `/${pieces.map(trimSlashes).filter((piece) => piece).join('/')}`;
};

export default joinPath;