/**
 * Returns initials from the first two words of a name. Returns "X" for invalid input.
 *
 * @param name - The full name string.
 * @returns Initials of the first two words, or "X" if invalid.
 *
 * Example:
 * getInitialsFromName("John Doe") -> "JD"
 * getInitialsFromName("Jane") -> "J"
 * getInitialsFromName("") -> "X"
 */
export const getInitialsFromName = (name) => {
    if (typeof name !== "string" || name.trim() === "") {
        return "X";
    }
    const nameData = name.split(" ").filter(Boolean); // Remove any empty strings from splitting
    if (nameData.length === 1) {
        return nameData[0][0].toUpperCase();
    }
    else {
        return `${nameData[0][0].toUpperCase()}${nameData[1][0].toUpperCase()}`;
    }
};
/**
 * Limits the full name to the first two words. Returns null for invalid input.
 *
 * @param fullName - The full name string to be limited.
 * @returns The first two words of the full name, or null if invalid.
 *
 * Example:
 * limitFullName("John Doe Smith") -> "John Doe"
 * limitFullName("Jane") -> "Jane"
 * limitFullName("") -> null
 */
export const limitFullName = (fullName) => {
    if (typeof fullName !== "string" || fullName.trim() === "") {
        return null;
    }
    const fullNameData = fullName.split(" ").filter(Boolean); // Remove any empty strings from splitting
    if (fullNameData.length === 1) {
        return fullNameData[0];
    }
    else {
        return `${fullNameData[0]} ${fullNameData[1]}`;
    }
};
//# sourceMappingURL=helpers.js.map
