add eol support
This commit is contained in:
parent
893e116fc4
commit
1e7b5cbe9f
|
@ -28,6 +28,7 @@ DEFAULT_WARN_FN = (msg) ->
|
|||
|
||||
module.exports = (str, indent, warn_fn, opts = {}) ->
|
||||
do_not_change_whitespace = !!opts?.do_not_change_whitespace
|
||||
eol = opts?.eol or '\n'
|
||||
indent = indent or DEFAULT_INDENT
|
||||
warn_fn = if typeof warn_fn == 'function' then warn_fn else DEFAULT_WARN_FN
|
||||
indent = ' '.repeat(indent) if Number.isInteger(indent)
|
||||
|
@ -102,4 +103,4 @@ module.exports = (str, indent, warn_fn, opts = {}) ->
|
|||
new_line or undefined
|
||||
|
||||
warn_fn 'positive indentation at the end' if $currIndent > 0
|
||||
new_code.join '\n'
|
||||
new_code.join eol
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = class Lua extends Beautifier
|
|||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
options.eol = @getDefaultLineEnding('\r\n','\n',options.end_of_line)
|
||||
new @Promise (resolve, reject) ->
|
||||
try
|
||||
resolve format text, options.indent_char.repeat(options.indent_size), @warn, options
|
||||
|
|
Loading…
Reference in New Issue