UNPKG

532 Btext/coffeescriptView Raw
1noflo = require 'noflo'
2owl = require 'owl-deepcopy'
3
4exports.getComponent = ->
5 c = new noflo.Component
6 c.description = 'deep (i.e. recursively) copy an object'
7 c.icon = 'copy'
8
9 c.inPorts.add 'in',
10 datatype: 'all'
11 description: 'Packet to be copied'
12 c.outPorts.add 'out',
13 datatype: 'all'
14 description: 'Copy of the original packet'
15
16 c.process (input, output) ->
17 return unless input.hasData 'in'
18 data = input.getData 'in'
19
20 copy = owl.deepCopy data
21 output.sendDone
22 out: copy
23 return