import memoize from "fast-memoize";
export const regex = /@\[([^*]+?)]\(([^*]+?)\)/gim;
const format = (text, data, withDisplay = false) => {
    const replaced = (text !== null && text !== void 0 ? text : "")
        .toString()
        .replace(regex, function (substring, display, id) {
        const result = data[id];
        return typeof result !== "undefined" && result !== null
            ? result
            : withDisplay
                ? display
                : "";
    });
    return replaced;
};
export default memoize(format);
//# sourceMappingURL=format.js.map