UNPKG

@salesforce/agents

Version:

Client side APIs for working with Salesforce agents

52 lines 1.54 kB
"use strict"; /* * Copyright (c) 2025, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeHtmlEntities = void 0; /** * Clean a string by replacing HTML entities with their respective characters. * * @param str - The string to clean. * @returns The cleaned string with all HTML entities replaced with their respective characters. */ const decodeHtmlEntities = (str = '') => { const entities = { '&quot;': '"', '&apos;': "'", '&amp;': '&', '&lt;': '<', '&gt;': '>', '&#39;': "'", '&deg;': '°', '&nbsp;': ' ', '&ndash;': '–', '&mdash;': '—', '&rsquo;': '’', '&lsquo;': '‘', '&ldquo;': '“', '&rdquo;': '”', '&hellip;': '…', '&trade;': '™', '&copy;': '©', '&reg;': '®', '&euro;': '€', '&pound;': '£', '&yen;': '¥', '&cent;': '¢', '&times;': '×', '&divide;': '÷', '&plusmn;': '±', '&micro;': 'µ', '&para;': '¶', '&sect;': '§', '&bull;': '•', '&middot;': '·', }; return str.replace(/&[a-zA-Z0-9#]+;/g, (entity) => entities[entity] || entity); }; exports.decodeHtmlEntities = decodeHtmlEntities; //# sourceMappingURL=utils.js.map