@memberjunction/global
Advanced tools
Comparing version 2.13.4 to 2.14.0
@@ -32,2 +32,9 @@ /** | ||
export declare function SafeJSONParse<T>(jsonString: string, logErrors?: boolean): T; | ||
/** | ||
* This function takes in a string of text(assuming markdown, or just newline formatted), and converts it to an HTML list. The list type can be either ordered or unordered. | ||
* @param htmlListType | ||
* @param text | ||
* @returns | ||
*/ | ||
export declare function ConvertMarkdownStringToHtmlList(htmlListType: 'Ordered' | 'Unordered', text: string): string; | ||
//# sourceMappingURL=util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SafeJSONParse = exports.CleanJavaScript = exports.CleanJSON = exports.CopyScalarsAndArrays = exports.GetGlobalObjectStore = void 0; | ||
exports.ConvertMarkdownStringToHtmlList = exports.SafeJSONParse = exports.CleanJavaScript = exports.CleanJSON = exports.CopyScalarsAndArrays = exports.GetGlobalObjectStore = void 0; | ||
/** | ||
@@ -157,2 +157,23 @@ * The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared | ||
exports.SafeJSONParse = SafeJSONParse; | ||
/** | ||
* This function takes in a string of text(assuming markdown, or just newline formatted), and converts it to an HTML list. The list type can be either ordered or unordered. | ||
* @param htmlListType | ||
* @param text | ||
* @returns | ||
*/ | ||
function ConvertMarkdownStringToHtmlList(htmlListType, text) { | ||
try { | ||
const listTag = htmlListType === 'Unordered' ? 'ul' : 'ol'; | ||
if (!text.includes('\n')) { | ||
return text; | ||
} | ||
const listItems = text.split('\n').map(line => `<li>${line.trim().replace(/^-\s*/, '')}</li>`).join(''); | ||
return `<${listTag}>${listItems}</${listTag}>`; | ||
} | ||
catch (e) { | ||
console.error("Error converting markdown string to HTML list:", e); | ||
return null; | ||
} | ||
} | ||
exports.ConvertMarkdownStringToHtmlList = ConvertMarkdownStringToHtmlList; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@memberjunction/global", | ||
"version": "2.13.4", | ||
"version": "2.14.0", | ||
"description": "MemberJunction: Global Object - Needed for ALL other MJ components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63901
826