mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
17 lines
387 B
TypeScript
17 lines
387 B
TypeScript
const beautify = require('js-beautify').js;
|
|
|
|
/**
|
|
* Beautifies code
|
|
*
|
|
* @param {string} code
|
|
* @param {" " | " "} character
|
|
* @returns {string}
|
|
*/
|
|
export function beautifyCode(code: string, character: 'space' | 'tab'): string {
|
|
const indentCharacter: string = character === 'space' ? '\x20' : '\x09';
|
|
|
|
return beautify(code, {
|
|
indent_char: indentCharacter
|
|
});
|
|
}
|