HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/Promotions/InPluginUpsells/resources/js/utils.js
/**
 * Replaces double asterisks with `<strong>` tags.
 *
 * @param {string} text
 * @returns {string}
 */
export function transformStrong(text) {
    // Keep track of whether we're inside a <strong> tag.
    let startingTag = false;

    return text.replaceAll('**', () => {
        // Reverse the starting tag state to determine the current state.
        startingTag = !startingTag;
        // Return the appropriate tag.
        return startingTag ? '<strong>' : '</strong>';
    });
}

/**
 * Replaces double asterisks with `<em>` tags.
 *
 * @param {string} text
 * @returns {string}
 */
export function transformEmphasis(text) {
    // Keep track of whether we're inside an <em> tag.
    let startingTag = false;

    return text.replaceAll('**', () => {
        // Reverse the starting tag state to determine the current state.
        startingTag = !startingTag;
        // Return the appropriate tag.
        return startingTag ? '<em>' : '</em>';
    });
}

/**
 * Get an asset URL.
 *
 * @param {string} filename (without leading slash).
 * @returns {string} asset URL
 */
export const assetUrl = (filename) => `${window.GiveAddons.assetsUrl}${filename}`;