import * as path from 'path' ; description see https export function copyPathResolve ( filePath , outDir , up ) { return path . join ( outDir , dealWith ( filePath , up ) ) ; } function dealWith ( inPath , up ) { if ( ! up ) { return inPath ; } if ( depth ( inPath ) < up ) { throw new Error ( 'cant go up that far' ) ; } return path . join ( ... path . normalize ( inPath ) . split ( path . sep ) . slice ( up ) ) ; } function depth ( string ) { return path . normalize ( string ) . split ( path . sep ) . length - 1 ; }