assets/scripts/menu/menu_manager.js
function detree(items, children, parent_id) {

		var item,
		    i;

		for (i = 0; i < children.length; i++) {

			item = children[i];

			if (parent_id) {
				item.parent = parent_id;
			}

			items.push(item);

			if (item.children) {
				detree(items, item.children, item.id);
			}

			delete item.children;
		}
	}
function detree(items, children, parent_id) {

		var item,
		    i;

		for (i = 0; i < children.length; i++) {

			item = children[i];

			if (parent_id) {
				item.parent = parent_id;
			}

			items.push(item);

			if (item.children) {
				detree(items, item.children, item.id);
			}

			delete item.children;
		}
	}
function detree ( items , children , parent_id ) { var item , i ; for ( i = 0 ; i < children . length ; i ++ ) { item = children [ i ] ; if ( parent_id ) { item . parent = parent_id ; } items . push ( item ) ; if ( item . children ) { detree ( items , item . children , item . id ) ; } delete item . children ; } }
Convert a nestable source data tree into a simple list

@author   Jelle De Loecker   <jelle@develry.be>
@since    0.0.1
@version  0.0.1

@param    {Array}   items
@param    {Object}  children
@param    {String}  parent_id
Convert a nestable source data tree into a simple list