let isDebug = false

/**
 * @param {boolean} newIsDebug 
 */
export const setDebug = (newIsDebug) => {
    isDebug = newIsDebug
}

export const getDebug = () => {
    return isDebug
}

export const debugLog = (/** @type {any[]} */ ...args) => {
    if(getDebug()){
        /**
         * @type {Array<any>} 
         */
        const newArgs = []
        args.forEach(arg => {
            if(typeof arg === 'function'){
                newArgs.push(arg())
            } else newArgs.push(arg)
        })
        console.log('[yjs]', ...newArgs)
    }
}