import type { TFile } from "obsidian" ; import { getDateFromFile , getDateUID } from "obsidian-daily-notes-interface" ; export const classList = ( obj ) : string [ ] => { return Object . entries ( obj ) . filter ( ( [ _k , v ] ) => ! ! v ) . map ( ( [ k , _k ] ) => k ) ; } ; export function clamp ( num , lowerBound , upperBound ) { return Math . min ( Math . max ( lowerBound , num ) , upperBound ) ; } param file export function getDateUIDFromFile ( file ) { if ( ! file ) { return null ; } let date = getDateFromFile ( file , "day" ) ; if ( date ) { return getDateUID ( date , "day" ) ; } date = getDateFromFile ( file , "week" ) ; if ( date ) { return getDateUID ( date , "week" ) ; } return null ; } export function escapeRegExp ( text ) { return text . replace ( /[-[\]{}()*+?.,\\^$|#\s]/g , '\\$&' ) ; } export function getLinesInString ( input ) { const lines = [ ] ; let tempString = input ; while ( tempString . contains ( "\n" ) ) { const lineEndIndex = tempString . indexOf ( "\n" ) ; lines . push ( tempString . slice ( 0 , lineEndIndex ) ) ; tempString = tempString . slice ( lineEndIndex + 1 ) ; } lines . push ( tempString ) ; return lines ; }