'use strict';

/**
 * returns a string that is a random UUID
 *
 * @returns {string} random UUID string.
 */
const generateUUID = () => {
  return (Date.now() + Math.floor(Math.random() * 10000)).toString();
};
/**
 * It returns true if the object is empty, and false if it's not.
 *
 * @param {unknown} object - The object to check if it's empty.
 * @returns {boolean} A function that takes an object as an argument and returns a boolean.
 */
const isObjectEmpty = (object) => {
  return object ? Object.keys(object).length === 0 : true;
};
/* istanbul ignore next */
// eslint-disable-next-line @typescript-eslint/no-empty-function,@typescript-eslint/ban-types
const AsyncFunction = (async () => { })['constructor'];
/**
 * The function `isAsyncFunction` checks if a given value is an asynchronous function.
 *
 * @param {unknown} fn - The `fn` parameter is the function that we want to check if it is an asynchronous function.
 * @returns {boolean} a boolean value. It returns true if the input `fn` is an async function, and false otherwise.
 */
const isAsyncFunction = (fn) => {
  if (typeof fn === 'function' &&
    (fn[Symbol.toStringTag] === 'AsyncFunction' || fn instanceof AsyncFunction === true)) {
    return true;
  }
  else {
    return false;
  }
};

exports.generateUUID = generateUUID;
exports.isAsyncFunction = isAsyncFunction;
exports.isObjectEmpty = isObjectEmpty;
