file author tony7lee
  import * as glob from 'glob' ; export param { string } cwd returns export function getPagePaths ( cwd ) { return glob . sync ( '**/*.+(tsx|jsx)' , { cwd } ) ; } export param { string } filePath returns export function getJsFilePathsIn ( filePath ) { return glob . sync ( `${ filePath }.@(ts?(x)|js?(x))` ) ; } export function isDynamicPath ( str ) { return typeof str === 'string' && /^\$\w+/ . test ( str ) ; } export function transformDynamicPath ( str ) { return str . replace ( /^\$/ , ':' ) ; } export function isOptionalDynamicPath ( str ) { return typeof str === 'string' && /^\$\w+\$$/ . test ( str ) ; } export function transformOptionalDynamicPath ( str ) { return transformDynamicPath ( str ) . replace ( /\$$/ , '?' ) ; } export function isNestFileName ( str ) { return typeof str === 'string' && /^_\w+/ . test ( str ) ; } export function upperCaseFirst ( str ) { if ( typeof str !== 'string' ) return '' ; return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ; } export function transformComponentName ( str ) { return str . replace ( /-/g , '$$$' ) ; } export function fillTabWith ( count ) { return new Array ( count ) . fill ( '  ' ) . join ( '' ) ; } export function formatPathForWin ( strPath ) { const isWin = process . platform === 'win32' ; return isWin ? strPath . replace ( /\\/g , '/' ) : strPath ; } const obj2Str = Object . prototype . toString ; export function isObject ( v ) { return obj2Str . call ( v ) === '[object Object]' ; }