import { mung } from ".";
Mung XML text content into some other form by means of a transform function.
Examples
▶Example 1
Example 1
import { mung } from 'xml-munger/mod.ts'
import { assertEquals } from 'std/assert/mod.ts'
const fn = (s: string) => s.toUpperCase()
const options = { each: 'a', from: 'b', to: 'c', fn }
const before = `<xml>
<a><b>text 1</b></a>
<a><b>text 2</b></a>
</xml>`
const after = `<xml>
<a><b>text 1</b><c>TEXT 1</c></a>
<a><b>text 2</b><c>TEXT 2</c></a>
</xml>`
assertEquals(mung(before, options), after)
Parameters
options: MungOptions
- Options describing how to mung the XML content