0.2.2 • Published 4 years ago
jsonbased-yamlify-pmb v0.2.2
jsonbased-yamlify-pmb
A simple, feature-incomplete YAML writer
API
This module ESM-exports one function with one method:
yamlify(x)
Returns a string containing a YAML representation of
the JSON-able portions of x.
yamlify.cfg(opt)
Return a potentially-customized version of the yamlify function.
opts is an optional options object that supports these keys:
dictUndef: The YAML representation ofundefinedin the role as the value of a dictionary entry. Defaults to the false-y valueundefined, which means to omit the entry.undef: The YAML representation to use forundefinedin cases wheredictUndefdoes not apply. Defaults to the false-y valueundefined, which means there is no YAML representation and instead a TypeError shall be thrown.trPrim: A dictionary object to translate primitive values (i.e. non-containers), orfalseto disable this feature. The dictionary should map JSON representations¹ to YAML representations. The default is to map Booleans toyesandno. (¹ For convenience, in addition to valid JSON as keys, you may specify a key namedundefinedto override theundefoption.)strQuotMark: Preferred quotation character for strings whose JSON representation contains neither this string nor a backslash. Default:"'"(U+0027 apostrophe)
Known issues
- Needs more/better tests and docs.
License
ISC