UNPKG

very-small-parser

Version:

A very small Markdown, HTML, and CSS parser.

17 lines (16 loc) 476 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toPlainText = void 0; const toPlainText = (node) => { if (node.type === 'text') return node.value || ''; let str = ''; const children = node.children; if (!children) return str; const length = children.length; for (let i = 0; i < length; i++) str += (0, exports.toPlainText)(children[i]); return str; }; exports.toPlainText = toPlainText;