import { isoLangs } from "./languages" ; export class Utils { monthNames = [ "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" , ] ; moveElement = ( startingPosition , scrollPosition , speedRatio ) => startingPosition - speedRatio * scrollPosition ; getMonthName ( date ) { return this . monthNames [ date . getMonth ( ) ] ; } mapLanguageCodeToName ( languageCode = "" ) { return isoLangs [ languageCode ] ?. name || languageCode ; } formatDate ( dateStr = "" ) { if ( ! dateStr || dateStr . length < 3 ) { return "" ; } const date = new Date ( dateStr ) ; return `${ this . getMonthName ( date ) } ${ date . getFullYear ( ) }` ; } } export let utils = new Utils ( ) ;