@ckeditor/ckeditor5-dev-utils
Version:
Utils for CKEditor 5 development tools packages.
25 lines (20 loc) • 624 B
JavaScript
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/
;
const javascriptStringify = require( 'javascript-stringify' );
/**
* Transforms specified configuration to a string that match to our code style.
*
* @param {Object} config
* @returns {String}
*/
module.exports = function getEditorConfig( config ) {
if ( !config ) {
return '{}';
}
return javascriptStringify( config, null, '\t' )
// Indent all but the first line (so it can be easily concatenated with `config = ${ editorConfig }`).
.replace( /\n/g, '\n\t' );
};