Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Options are :
* {colors} [colors] : Output colors. See below
* {boolean} [alignKeyValues] : Align key values. Default: true
* {boolean} [hideUndefined] : Do not display undefined values. Default: false
* {boolean} [noSeparator] : Do not display key separator Default: false

Colors are :
* {string} [keys] : Objects keys color. Default: green
Expand Down
4 changes: 3 additions & 1 deletion lib/prettyoutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports.internals = internals
* @property {colors} [colors] - input colors
* @property {boolean} [alignKeyValues] - Align key values. Default: true
* @property {boolean} [hideUndefined] - Show undefined values. Default: false
* @property {boolean} [noSeparator] - Do not display key separator. Default: false
*/

/**
Expand Down Expand Up @@ -57,7 +58,8 @@ internals.parseOptions = opts => {
maxDepth: opts.maxDepth || 3,
colors: !opts.noColor ? colors : null,
alignKeyValues: _.isBoolean(opts.alignKeyValues) ? opts.alignKeyValues : true,
hideUndefined: _.isBoolean(opts.hideUndefined) ? opts.hideUndefined : false
hideUndefined: _.isBoolean(opts.hideUndefined) ? opts.hideUndefined : false,
noSeparator: _.isBoolean(opts.noSeparator) ? opts.noSeparator : false
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports.renderEmptyArray = function(options, indentation) {

exports.renderObjectKey = function(key, options, indentation) {
const colors = options.colors || {}
const output = `${indentation}${key}: `
const output = `${indentation}${key}${options.noSeparator ? '' : ':'} `

return utils.colorString(output, colors.keys)
}
Expand Down