Skip to content

Commit ee14eab

Browse files
dod38frVitaly Puzrin
authored andcommitted
clarify usage of style option
1 parent f6bafed commit ee14eab

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

README.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,42 @@ options:
183183
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
184184
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
185185

186-
styles:
186+
The following table show availlable styles (e.g. "canonical",
187+
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
188+
ouput is shown on the right side after `=>` (default setting) or `->`:
187189

188190
``` none
189191
!!null
190-
"canonical" => "~"
192+
"canonical" -> "~"
193+
"lowercase" => "null"
194+
"uppercase" -> "NULL"
195+
"camelcase" -> "Null"
191196
192197
!!int
193-
"binary" => "0b1", "0b101010", "0b1110001111010"
194-
"octal" => "01", "052", "016172"
198+
"binary" -> "0b1", "0b101010", "0b1110001111010"
199+
"octal" -> "01", "052", "016172"
195200
"decimal" => "1", "42", "7290"
196-
"hexadecimal" => "0x1", "0x2A", "0x1C7A"
197-
198-
!!null, !!bool, !!float
199-
"lowercase" => "null", "true", "false", ".nan", '.inf'
200-
"uppercase" => "NULL", "TRUE", "FALSE", ".NAN", '.INF'
201-
"camelcase" => "Null", "True", "False", ".NaN", '.Inf'
201+
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
202+
203+
!!bool
204+
"lowercase" => "true", "false"
205+
"uppercase" -> "TRUE", "FALSE"
206+
"camelcase" -> "True", "False"
207+
208+
!!float
209+
"lowercase" => ".nan", '.inf'
210+
"uppercase" -> ".NAN", '.INF'
211+
"camelcase" -> ".NaN", '.Inf'
202212
```
203213

204-
By default, !!int uses `decimal`, and !!null, !!bool, !!float use `lowercase`.
205-
214+
Example:
206215

216+
safeDump (object, {
217+
'styles': {
218+
'!!null': 'canonical' // dump null as ~
219+
},
220+
'sortKeys': true // sort
221+
}
207222

208223
### dump (object [ , options ])
209224

0 commit comments

Comments
 (0)