pear-terminal 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -277,7 +277,7 @@ function indicator(value, type = 'success') {
277
277
  if (type === 'diff') {
278
278
  return value === 0 ? ansi.yellow('~') : value === 1 ? ansi.green('+') : ansi.red('-')
279
279
  }
280
- return value < 0 ? ansi.cross + ' ' : value > 0 ? ansi.tick + ' ' : ansi.gray('- ')
280
+ return value < 0 ? ansi.cross + ' ' : value === 1 ? ansi.tick + ' ' : (value > 1 ? '' : ansi.gray('- '))
281
281
  }
282
282
 
283
283
  const outputter =
@@ -292,12 +292,12 @@ const outputter =
292
292
  stdio.out.write(ansi.showCursor())
293
293
  })
294
294
  : null
295
- if (typeof opts === 'boolean') opts = { json: opts }
296
- const { json = false, log, mod = () => {} } = opts
295
+ if (typeof opts === 'boolean' || typeof opts === 'function') opts = { json: opts }
296
+ const { json = false, log } = opts
297
297
  const promise = opwait(stream, ({ tag, data }) => {
298
- mod(tag, data)
299
298
  if (json) {
300
- const str = JSON.stringify({ cmd, tag, data })
299
+ const replacer = typeof json === 'function' ? json : null
300
+ const str = JSON.stringify({ cmd, tag, data }, replacer)
301
301
  if (log) log(str)
302
302
  else print(str)
303
303
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-terminal",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "main": "index.js",
5
5
  "type": "commonjs",
6
6
  "description": "Pear Terminal User Interface library",