import { unixEOL } from './string-formatter' ; param str returns export function encodeBase64 ( str ) { return Buffer . from ( str ) . toString ( 'base64' ) ; } param string returns export function trimLeft ( string ) { let subStrings = string . split ( unixEOL ) ; if ( ! subStrings [ 0 ] . trim ( ) ) { subStrings = subStrings . slice ( 1 ) ; } return subStrings . join ( unixEOL ) ; } param string returns export function trimRight ( string ) { let subStrings = string . split ( unixEOL ) ; if ( ! subStrings [ subStrings . length - 1 ] . trim ( ) ) { subStrings = subStrings . slice ( 0 , - 1 ) ; } return subStrings . join ( unixEOL ) ; } param string returns export function trim ( string ) { return trimRight ( trimLeft ( string ) ) ; } param fileName returns export function removeFileExtension ( fileName ) { return fileName . includes ( '.' ) ? fileName . split ( '.' ) . slice ( 0 , - 1 ) . join ( '.' ) : fileName ; }