MCPcopy Create free account
hub / github.com/danvk/webdiff / htmlToText

Function htmlToText

ts/codediff/__tests__/htmlsubstr_test.ts:4–9  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

2import {htmlTextMapper} from '../html-text-mapper';
3
4function htmlToText(html: string) {
5 const div = document.createElement('div');
6 div.innerHTML = html;
7 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
8 return div.textContent ?? '';
9}
10
11test('basic functionality', () => {
12 const html = 'foo<span>bar</span>baz';

Callers 1

htmlsubstr_test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected