UNPKG

884 Btext/coffeescriptView Raw
1# @runtime noflo-nodejs
2noflo = require 'noflo'
3
4unless noflo.isBrowser()
5 util = require 'util'
6else
7 util =
8 inspect: (data) -> data
9
10log = (options, data) ->
11 if options?
12 console.log util.inspect data,
13 options.showHidden, options.depth, options.colors
14 else
15 console.log data
16
17exports.getComponent = ->
18 c = new noflo.Component
19 c.description = 'Sends the data items to console.log'
20 c.icon = 'bug'
21
22 c.inPorts.add 'in',
23 datatype: 'all'
24 description: 'Packet to be printed through console.log'
25 c.inPorts.add 'options',
26 datatype: 'object'
27 description: 'Options to be passed to console.log'
28 c.outPorts.add 'out',
29 datatype: 'all'
30
31 noflo.helpers.WirePattern c,
32 in: 'in'
33 out: 'out'
34 forwardGroups: true
35 async: true
36 , (data, groups, out, callback) ->
37 log c.params.options, data
38 out.send data
39 do callback
40
41 c