'use strict' ; export function getFileNoExtension ( filePath ) { let index = filePath . lastIndexOf ( "." ) ; if ( index !== - 1 ) { return filePath . substr ( 0 , index ) ; } else { return filePath ; } } export function quoteFileName ( filePath ) { if ( filePath . match ( /\s/ ) ) { filePath = '"' + filePath . replace ( /"/g , '\"' ) + '"' ; } return filePath ; } export function replaceVar ( originalStr , varName , value ) { let regx = new RegExp ( "\\$\\{" + varName + "([\\W][^ }]+)?\\}" , "g" ) ; if ( value . match ( /\s/ ) ) { value = value . replace ( /"/g , '\\"' ) ; return originalStr . replace ( regx , '"' + value + '$1"' ) ; } return originalStr . replace ( regx , value + '$1' ) ; } export function unwrap ( proxy ) { if ( typeof proxy !== 'object' ) { return proxy ; } let obj = { } ; Object . keys ( proxy ) . forEach ( function ( key ) { let s = proxy [ key ] ; let u = unwrap ( s ) ; obj [ key ] = u ; } ) ; return obj ; }