Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 361613f507 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.28.15",
|
"version": "0.28.16",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -27,6 +27,31 @@ export function camelCase(str?: string): string {
|
|||||||
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode HTML escaped characters
|
||||||
|
* @param html HTML to clean up
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
export function decodeHtml(html: string) {
|
||||||
|
return html
|
||||||
|
.replace(/ /g, '\u00A0')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/¢/g, '¢')
|
||||||
|
.replace(/£/g, '£')
|
||||||
|
.replace(/¥/g, '¥')
|
||||||
|
.replace(/€/g, '€')
|
||||||
|
.replace(/©/g, '©')
|
||||||
|
.replace(/®/g, '®')
|
||||||
|
.replace(/™/g, '™')
|
||||||
|
.replace(/×/g, '×')
|
||||||
|
.replace(/÷/g, '÷')
|
||||||
|
.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec))
|
||||||
|
.replace(/&#x([0-9a-fA-F]+);/g, (match, hex) => String.fromCharCode(parseInt(hex, 16)))
|
||||||
|
.replace(/&/g, '&'); // Always last!
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert number of bytes into a human-readable size
|
* Convert number of bytes into a human-readable size
|
||||||
|
|||||||
Reference in New Issue
Block a user