UNPKG

@ryusei/light

Version:

<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>

20 lines (15 loc) 463 B
import { isUndefined } from '../../type/type'; export function text( node: Node ): string; export function text( node: Node, text: string ): void; /** * Sets or gets a text content of the provided node. * * @param node - A node to get or set a text. * @param text - Optional. A text to set. */ export function text( node: Node, text?: string ): string | void { if ( isUndefined( text ) ) { return node.textContent; } node.textContent = text; }