src/editorconfig.js
function format(source, style) {
	if (style.insert_final_newline !== undefined) {
		const has = hasTrailingNewLine(source);
		if (style.insert_final_newline && !has) {
			source += '\n';
		} else if (!style.insert_final_newline && has) {
			source = source.replace(TRAILING_NEW_LINE_REGEXP, '');
		}
	}

	return source;
}
function format(source, style) {
	if (style.insert_final_newline !== undefined) {
		const has = hasTrailingNewLine(source);
		if (style.insert_final_newline && !has) {
			source += '\n';
		} else if (!style.insert_final_newline && has) {
			source = source.replace(TRAILING_NEW_LINE_REGEXP, '');
		}
	}

	return source;
}
function format ( source , style ) { if ( style . insert_final_newline !== undefined ) { const has = hasTrailingNewLine ( source ) ; if ( style . insert_final_newline && ! has ) { source += '\n' ; } else if ( ! style . insert_final_newline && has ) { source = source . replace ( TRAILING_NEW_LINE_REGEXP , '' ) ; } } return source ; }
Reformat text according to a given EditorCofnig style.

Suports: insert_final_newline

@param {string} source
@param {EditorConfigStyle} style
@return {string}
Reformat text according to a given EditorCofnig style .