-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Welcome: format option #29
Conversation
4c3e21e
to
c4f2877
Compare
/// - target: target | ||
/// - debug: Enable debug-level output if `true` (like `debugPrint`) | ||
/// - pretty: Enable pretty output if `true` | ||
func string<T: Any>(_ target: T, debug: Bool, pretty: Bool) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename elementString
to string
.
func _string(_ target: Any) -> String { | ||
string(target, debug: debug, pretty: pretty) // fixed `debug` and `pretty` | ||
} | ||
|
||
func _value(_ target: Any) -> String { | ||
valueString(target, debug: debug) // fixed `debug` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add local function that fixed arguments debug
and pretty
.
let label = _value(key) | ||
let value = _string(val).indentTail(size: "\(label): ".count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change call to local function _value
and _string
here and other.
@@ -0,0 +1,147 @@ | |||
class Pretty { | |||
private var indent: Int { Debug.option.indent } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is alias for Debug.option.indent
.
Introduce
Option
struct that representformat-option
such asindent-size
.And some refactors :)
TODO
master