typedef SplitLinesOptions property { boolean } trim property { boolean } removeEmptyEntries declare interface String { param { SplitLinesOptions = } splitOptions splitLines ( splitOptions ? ) : string [ ] ; /**
     * Appropriately formats a string so it can be used as an argument for a command in a shell.
     * E.g. if an argument contains a space, then it will be enclosed within double quotes.
     */ toCommandArgument ( ) : string ; /**
     * Appropriately formats a a file path so it can be used as an argument for a command in a shell.
     * E.g. if an argument contains a space, then it will be enclosed within double quotes.
     */ fileToCommandArgument ( ) : string ; /**
     * String.format() implementation.
     * Tokens such as {0}, {1} will be replaced with corresponding positional arguments.
     */ format ( ... args ) : string ; /**
     * String.trimQuotes implementation
     * Removes leading and trailing quotes from a string
     */ trimQuotes ( ) : string ; } param { SplitLinesOptions = } splitOptions String . prototype . splitLines = function ( this , splitOptions = { removeEmptyEntries : true , trim : true } ) : string [ ] { let lines = this . split ( /\r?\n/g ) ; if ( splitOptions && splitOptions . trim ) { lines = lines . map ( line => line . trim ( ) ) ; } if ( splitOptions && splitOptions . removeEmptyEntries ) { lines = lines . filter ( line => line . length > 0 ) ; } return lines ; } ; param { String } value . String . prototype . toCommandArgument = function ( this ) : string { if ( ! this ) { return this ; } return ( this . indexOf ( ' ' ) >= 0 && ! this . startsWith ( '"' ) && ! this . endsWith ( '"' ) ) ? `"${ this }"` : this . toString ( ) ; } ; /**
 * Appropriately formats a a file path so it can be used as an argument for a command in a shell.
 * E.g. if an argument contains a space, then it will be enclosed within double quotes.
 */ String . prototype . fileToCommandArgument = function ( this ) : string { if ( ! this ) { return this ; } return this . toCommandArgument ( ) . replace ( /\\/g , '/' ) ; } ; /**
 * String.trimQuotes implementation
 * Removes leading and trailing quotes from a string
 */ String . prototype . trimQuotes = function ( this ) : string { if ( ! this ) { return this ; } return this . replace ( /(^['"])|(['"]$)/g , '' ) ; } ; declare interface Promise < T > { /**
     * Catches task error and ignores them.
     */ ignoreErrors ( ) : void ; } /**
 * Explicitly tells that promise should be run asynchonously.
 */ Promise . prototype . ignoreErrors = function < T > ( this ) { this . catch ( ( ) => { } ) ; } ; if ( ! String . prototype . format ) { String . prototype . format = function ( this ) { const args = arguments ; return this . replace ( /{(\d+)}/g , ( match , number ) => args [ number ] === undefined ? match : args [ number ] ) ; } ; }