export default class Path { static resolve ( path ) { return `/${ this . trim ( path ) }` ; } static parts ( path ) { return this . trim ( path ) . split ( '/' ) ; } static getParent ( path ) { const parts = this . parts ( path ) ; parts . pop ( ) ; return `/${ parts . join ( '/' ) }` ; } static getName ( path ) { const parts = this . parts ( path ) ; return parts . pop ( ) || '' ; } static join ( parent , name ) { parent = this . trim ( parent ) ; name = this . trim ( name ) ; return parent == '' ? `/${ name }` : `/${ parent }/${ name }` ; } private static trim ( path ) { path = decodeURIComponent ( path ) ; path = path . replace ( /'/g , "\\'" ) ; path = path . replace ( /^(\s|\/)+|(\s|\/)+$/g , '' ) ; return path ; } }