UNPKG

@ryusei/code

Version:

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

15 lines (12 loc) 397 B
import { toArray } from '../../array'; /** * Prepends children to the specified parent node. * * @param parent - A parent node. * @param children - A child or children to prepend to the parent. */ export function prepend( parent: Node, children: Node | Node[] ): void { toArray( children ).forEach( child => { parent.insertBefore( child, parent.firstChild ); } ); }