@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
41 lines • 1.26 kB
JavaScript
// Decode HTML entities
export function decodeHtmlEntities(text) {
const entities = {
' ': ' ',
'&': '&',
'<': '<',
'>': '>',
'"': '"',
''': "'",
'©': '©',
'®': '®',
'™': '™',
'€': '€',
'£': '£',
'¥': '¥',
'¢': '¢',
'§': '§',
'°': '°',
'±': '±',
'×': '×',
'÷': '÷',
'–': '–',
'—': '—',
'‘': '\u2018',
'’': '\u2019',
'“': '\u201C',
'”': '\u201D',
'…': '…',
'•': '•',
};
let result = text;
// Replace named entities
for (const [entity, char] of Object.entries(entities)) {
result = result.replace(new RegExp(entity, 'g'), char);
}
// Replace numeric entities (e.g.,   or  )
result = result.replace(/&#(\d+);/g, (_match, code) => String.fromCharCode(parseInt(code, 10)));
result = result.replace(/&#x([0-9A-Fa-f]+);/g, (_match, code) => String.fromCharCode(parseInt(code, 16)));
return result;
}
//# sourceMappingURL=html-entities.js.map