pear-terminal 1.1.2 → 1.1.3
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.
- package/index.js +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|