source/index.js
function split_lines_by_child_nodes(lines)
{
	// determine lines with indentation = 0 (child node entry lines)
	const node_entry_lines = lines.map((line, index) => 
	{
		return { tabs: line.tabs, index }
	})
	.filter(line => line.tabs === 0)
	.map(line => line.index)

	// deduce corresponding child node ending lines
	const node_ending_lines = node_entry_lines.map(line_index => line_index - 1)
	node_ending_lines.shift()
	node_ending_lines.push(lines.length - 1)

	// each child node boundaries in terms of starting line index and ending line index
	const from_to = zip(node_entry_lines, node_ending_lines)

	// now lines are split by child nodes
	return from_to.map(from_to => lines.slice(from_to[0], from_to[1] + 1))
}
function split_lines_by_child_nodes(lines)
{
	// determine lines with indentation = 0 (child node entry lines)
	const node_entry_lines = lines.map((line, index) => 
	{
		return { tabs: line.tabs, index }
	})
	.filter(line => line.tabs === 0)
	.map(line => line.index)

	// deduce corresponding child node ending lines
	const node_ending_lines = node_entry_lines.map(line_index => line_index - 1)
	node_ending_lines.shift()
	node_ending_lines.push(lines.length - 1)

	// each child node boundaries in terms of starting line index and ending line index
	const from_to = zip(node_entry_lines, node_ending_lines)

	// now lines are split by child nodes
	return from_to.map(from_to => lines.slice(from_to[0], from_to[1] + 1))
}
function split_lines_by_child_nodes ( lines ) { // determine lines with indentation = 0 (child node entry lines) const node_entry_lines = lines . map ( ( line , index ) => { return { tabs : line . tabs , index } } ) . filter ( line => line . tabs === 0 ) . map ( line => line . index ) // deduce corresponding child node ending lines const node_ending_lines = node_entry_lines . map ( line_index => line_index - 1 ) node_ending_lines . shift ( ) node_ending_lines . push ( lines . length - 1 ) // each child node boundaries in terms of starting line index and ending line index const from_to = zip ( node_entry_lines , node_ending_lines ) // now lines are split by child nodes return from_to . map ( from_to => lines . slice ( from_to [ 0 ] , from_to [ 1 ] + 1 ) ) }
takes the whole lines array and splits it by its top-tier child nodes
takes the whole lines array and splits it by its top - tier child nodes