%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/node_modules/input-format/source/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/node_modules/input-format/source/closeBraces.js

import { count_occurences } from './helpers.js'

export default function closeBraces(retained_template, template, placeholder = 'x', empty_placeholder = ' ')
{
	let cut_before = retained_template.length

	const opening_braces = count_occurences('(', retained_template)
	const closing_braces = count_occurences(')', retained_template)

	let dangling_braces = opening_braces - closing_braces

	while (dangling_braces > 0 && cut_before < template.length)
	{
		retained_template += template[cut_before].replace(placeholder, empty_placeholder)

		if (template[cut_before] === ')')
		{
			dangling_braces--
		}

		cut_before++
	}

	return retained_template
}

Zerion Mini Shell 1.0