/**
* @module getChildren
* @description Get immediate child nodes of a passed element and return an array of them.
*
* @since 1.0.0
*
* @param {HTMLElement} el The element to get all immediate children for.
*
* @return {Array} Iterable array of dom nodes.
*
* @example
* import { getChildren } from "@gravityforms/utils";
*
* function Example() {
* const node = document.getElementById( 'example' );
* const children = getChildren( node );
* }
*
*/
export default function getChildren( el ) {
const children = [];
let i = el.children.length;
for ( i; i --; ) { // eslint-disable-line
if ( el.children[ i ].nodeType !== 8 ) {
children.unshift( el.children[ i ] );
}
}
return children;
}