{"action":"created","comment":{"url":"https://api.github.com/repos/noflo/noflo-objects/pulls/comments/66654469","id":66654469,"diff_hunk":"@@ -1,58 +1,53 @@\n noflo = require 'noflo'\n \n-class DuplicateProperty extends noflo.Component\n-  constructor: ->\n-    @properties = {}\n-    @separator = '/'\n-\n-    @inPorts = new noflo.InPorts\n-      property:\n-        datatype: 'all'\n-      separator:\n-        datatype: 'string'\n-      in:\n-        datatype: 'object'\n-    @outPorts = new noflo.OutPorts\n-      out:\n-        datatype: 'object'\n-\n-    @inPorts.property.on 'data', (data) =>\n-      @setProperty data\n-    @inPorts.separator.on 'data', (data) =>\n-      @separator = data\n-\n-    @inPorts.in.on 'begingroup', (group) =>\n-      @outPorts.out.beginGroup group\n-    @inPorts.in.on 'data', (data) =>\n-      @addProperties data\n-    @inPorts.in.on 'endgroup', =>\n-      @outPorts.out.endGroup()\n-    @inPorts.in.on 'disconnect', =>\n-      @outPorts.out.disconnect()\n-\n-  setProperty: (prop) ->\n-    if typeof prop is 'object'\n-      @prop = prop\n-      return\n-\n-    propParts = prop.split '='\n-    if propParts.length > 2\n-      @properties[propParts.pop()] = propParts\n-      return\n-\n-    @properties[propParts[1]] = propParts[0]\n-\n-  addProperties: (object) ->\n-    for newprop, original of @properties\n-      if typeof original is 'string'\n-        object[newprop] = object[original]\n-        continue\n-\n-      newValues = []\n-      for originalProp in original\n-        newValues.push object[originalProp]\n-      object[newprop] = newValues.join @separator\n-\n-    @outPorts.out.send object\n-\n-exports.getComponent = -> new DuplicateProperty\n+exports.getComponent = ->\n+  c = new noflo.Component\n+\n+  c.inPorts = new noflo.InPorts\n+    property:\n+      datatype: 'all'\n+      required: true\n+      description: 'property to duplicate'\n+    separator:\n+      datatype: 'string'\n+      description: 'default is `/`'\n+      required: true\n+    in:\n+      datatype: 'object'\n+      description: 'object to duplicate property on'\n+      required: true\n+  c.outPorts = new noflo.OutPorts\n+    out:\n+      datatype: 'object'\n+\n+  c.process (input, output) ->\n+    return unless input.has 'property', 'separator', 'in'\n+    [prop, sep, data] = input.getData 'property', 'separator', 'in'\n+    return unless input.ip.type is 'data'\n+\n+    properties = {}\n+    separator = if sep? then sep else '/'","path":"components/DuplicateProperty.coffee","position":85,"original_position":85,"commit_id":"a2bb246930c319d0701d3f02e8d6d41150272c0b","original_commit_id":"92324e980c842957168e6470f6699c097e426544","user":{"login":"bergie","id":3346,"avatar_url":"https://avatars.githubusercontent.com/u/3346?v=3","gravatar_id":"","url":"https://api.github.com/users/bergie","html_url":"https://github.com/bergie","followers_url":"https://api.github.com/users/bergie/followers","following_url":"https://api.github.com/users/bergie/following{/other_user}","gists_url":"https://api.github.com/users/bergie/gists{/gist_id}","starred_url":"https://api.github.com/users/bergie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bergie/subscriptions","organizations_url":"https://api.github.com/users/bergie/orgs","repos_url":"https://api.github.com/users/bergie/repos","events_url":"https://api.github.com/users/bergie/events{/privacy}","received_events_url":"https://api.github.com/users/bergie/received_events","type":"User","site_admin":false},"body":"Simple pattern (replacing also some of earlier lines) that I've been using is:\r\n\r\n```\r\nseparator = if input.has('separator') then input.getData('separator') else '/'","created_at":"2016-06-10T17:53:12Z","updated_at":"2016-06-10T17:53:12Z","html_url":"https://github.com/noflo/noflo-objects/pull/79#discussion_r66654469","pull_request_url":"https://api.github.com/repos/noflo/noflo-objects/pulls/79","_links":{"self":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/comments/66654469"},"html":{"href":"https://github.com/noflo/noflo-objects/pull/79#discussion_r66654469"},"pull_request":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/79"}}},"pull_request":{"url":"https://api.github.com/repos/noflo/noflo-objects/pulls/79","id":73406515,"html_url":"https://github.com/noflo/noflo-objects/pull/79","diff_url":"https://github.com/noflo/noflo-objects/pull/79.diff","patch_url":"https://github.com/noflo/noflo-objects/pull/79.patch","issue_url":"https://api.github.com/repos/noflo/noflo-objects/issues/79","number":79,"state":"open","locked":false,"title":"Port to process api and noflo 0.7, add test coverage.","user":{"login":"meetupbath","id":19858605,"avatar_url":"https://avatars.githubusercontent.com/u/19858605?v=3","gravatar_id":"","url":"https://api.github.com/users/meetupbath","html_url":"https://github.com/meetupbath","followers_url":"https://api.github.com/users/meetupbath/followers","following_url":"https://api.github.com/users/meetupbath/following{/other_user}","gists_url":"https://api.github.com/users/meetupbath/gists{/gist_id}","starred_url":"https://api.github.com/users/meetupbath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetupbath/subscriptions","organizations_url":"https://api.github.com/users/meetupbath/orgs","repos_url":"https://api.github.com/users/meetupbath/repos","events_url":"https://api.github.com/users/meetupbath/events{/privacy}","received_events_url":"https://api.github.com/users/meetupbath/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-10T17:16:34Z","updated_at":"2016-06-10T17:53:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0ab30f5c88bb83fd5da0e5fe2b10b795e8c6c27","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/noflo/noflo-objects/pulls/79/commits","review_comments_url":"https://api.github.com/repos/noflo/noflo-objects/pulls/79/comments","review_comment_url":"https://api.github.com/repos/noflo/noflo-objects/pulls/comments{/number}","comments_url":"https://api.github.com/repos/noflo/noflo-objects/issues/79/comments","statuses_url":"https://api.github.com/repos/noflo/noflo-objects/statuses/a2bb246930c319d0701d3f02e8d6d41150272c0b","head":{"label":"meetupbath:noflo7","ref":"noflo7","sha":"a2bb246930c319d0701d3f02e8d6d41150272c0b","user":{"login":"meetupbath","id":19858605,"avatar_url":"https://avatars.githubusercontent.com/u/19858605?v=3","gravatar_id":"","url":"https://api.github.com/users/meetupbath","html_url":"https://github.com/meetupbath","followers_url":"https://api.github.com/users/meetupbath/followers","following_url":"https://api.github.com/users/meetupbath/following{/other_user}","gists_url":"https://api.github.com/users/meetupbath/gists{/gist_id}","starred_url":"https://api.github.com/users/meetupbath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetupbath/subscriptions","organizations_url":"https://api.github.com/users/meetupbath/orgs","repos_url":"https://api.github.com/users/meetupbath/repos","events_url":"https://api.github.com/users/meetupbath/events{/privacy}","received_events_url":"https://api.github.com/users/meetupbath/received_events","type":"User","site_admin":false},"repo":{"id":60853175,"name":"noflo-objects","full_name":"meetupbath/noflo-objects","owner":{"login":"meetupbath","id":19858605,"avatar_url":"https://avatars.githubusercontent.com/u/19858605?v=3","gravatar_id":"","url":"https://api.github.com/users/meetupbath","html_url":"https://github.com/meetupbath","followers_url":"https://api.github.com/users/meetupbath/followers","following_url":"https://api.github.com/users/meetupbath/following{/other_user}","gists_url":"https://api.github.com/users/meetupbath/gists{/gist_id}","starred_url":"https://api.github.com/users/meetupbath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetupbath/subscriptions","organizations_url":"https://api.github.com/users/meetupbath/orgs","repos_url":"https://api.github.com/users/meetupbath/repos","events_url":"https://api.github.com/users/meetupbath/events{/privacy}","received_events_url":"https://api.github.com/users/meetupbath/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/meetupbath/noflo-objects","description":"Object Utilities for NoFlo","fork":true,"url":"https://api.github.com/repos/meetupbath/noflo-objects","forks_url":"https://api.github.com/repos/meetupbath/noflo-objects/forks","keys_url":"https://api.github.com/repos/meetupbath/noflo-objects/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meetupbath/noflo-objects/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meetupbath/noflo-objects/teams","hooks_url":"https://api.github.com/repos/meetupbath/noflo-objects/hooks","issue_events_url":"https://api.github.com/repos/meetupbath/noflo-objects/issues/events{/number}","events_url":"https://api.github.com/repos/meetupbath/noflo-objects/events","assignees_url":"https://api.github.com/repos/meetupbath/noflo-objects/assignees{/user}","branches_url":"https://api.github.com/repos/meetupbath/noflo-objects/branches{/branch}","tags_url":"https://api.github.com/repos/meetupbath/noflo-objects/tags","blobs_url":"https://api.github.com/repos/meetupbath/noflo-objects/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meetupbath/noflo-objects/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meetupbath/noflo-objects/git/refs{/sha}","trees_url":"https://api.github.com/repos/meetupbath/noflo-objects/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meetupbath/noflo-objects/statuses/{sha}","languages_url":"https://api.github.com/repos/meetupbath/noflo-objects/languages","stargazers_url":"https://api.github.com/repos/meetupbath/noflo-objects/stargazers","contributors_url":"https://api.github.com/repos/meetupbath/noflo-objects/contributors","subscribers_url":"https://api.github.com/repos/meetupbath/noflo-objects/subscribers","subscription_url":"https://api.github.com/repos/meetupbath/noflo-objects/subscription","commits_url":"https://api.github.com/repos/meetupbath/noflo-objects/commits{/sha}","git_commits_url":"https://api.github.com/repos/meetupbath/noflo-objects/git/commits{/sha}","comments_url":"https://api.github.com/repos/meetupbath/noflo-objects/comments{/number}","issue_comment_url":"https://api.github.com/repos/meetupbath/noflo-objects/issues/comments{/number}","contents_url":"https://api.github.com/repos/meetupbath/noflo-objects/contents/{+path}","compare_url":"https://api.github.com/repos/meetupbath/noflo-objects/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meetupbath/noflo-objects/merges","archive_url":"https://api.github.com/repos/meetupbath/noflo-objects/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meetupbath/noflo-objects/downloads","issues_url":"https://api.github.com/repos/meetupbath/noflo-objects/issues{/number}","pulls_url":"https://api.github.com/repos/meetupbath/noflo-objects/pulls{/number}","milestones_url":"https://api.github.com/repos/meetupbath/noflo-objects/milestones{/number}","notifications_url":"https://api.github.com/repos/meetupbath/noflo-objects/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meetupbath/noflo-objects/labels{/name}","releases_url":"https://api.github.com/repos/meetupbath/noflo-objects/releases{/id}","deployments_url":"https://api.github.com/repos/meetupbath/noflo-objects/deployments","created_at":"2016-06-10T14:19:22Z","updated_at":"2016-06-10T14:19:26Z","pushed_at":"2016-06-10T17:51:32Z","git_url":"git://github.com/meetupbath/noflo-objects.git","ssh_url":"git@github.com:meetupbath/noflo-objects.git","clone_url":"https://github.com/meetupbath/noflo-objects.git","svn_url":"https://github.com/meetupbath/noflo-objects","homepage":"","size":204,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"noflo:master","ref":"master","sha":"6d0d77d7709b7eb72919f7ec9af9e6920e72be38","user":{"login":"noflo","id":1485822,"avatar_url":"https://avatars.githubusercontent.com/u/1485822?v=3","gravatar_id":"","url":"https://api.github.com/users/noflo","html_url":"https://github.com/noflo","followers_url":"https://api.github.com/users/noflo/followers","following_url":"https://api.github.com/users/noflo/following{/other_user}","gists_url":"https://api.github.com/users/noflo/gists{/gist_id}","starred_url":"https://api.github.com/users/noflo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noflo/subscriptions","organizations_url":"https://api.github.com/users/noflo/orgs","repos_url":"https://api.github.com/users/noflo/repos","events_url":"https://api.github.com/users/noflo/events{/privacy}","received_events_url":"https://api.github.com/users/noflo/received_events","type":"Organization","site_admin":false},"repo":{"id":9583969,"name":"noflo-objects","full_name":"noflo/noflo-objects","owner":{"login":"noflo","id":1485822,"avatar_url":"https://avatars.githubusercontent.com/u/1485822?v=3","gravatar_id":"","url":"https://api.github.com/users/noflo","html_url":"https://github.com/noflo","followers_url":"https://api.github.com/users/noflo/followers","following_url":"https://api.github.com/users/noflo/following{/other_user}","gists_url":"https://api.github.com/users/noflo/gists{/gist_id}","starred_url":"https://api.github.com/users/noflo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noflo/subscriptions","organizations_url":"https://api.github.com/users/noflo/orgs","repos_url":"https://api.github.com/users/noflo/repos","events_url":"https://api.github.com/users/noflo/events{/privacy}","received_events_url":"https://api.github.com/users/noflo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/noflo/noflo-objects","description":"Object Utilities for NoFlo","fork":false,"url":"https://api.github.com/repos/noflo/noflo-objects","forks_url":"https://api.github.com/repos/noflo/noflo-objects/forks","keys_url":"https://api.github.com/repos/noflo/noflo-objects/keys{/key_id}","collaborators_url":"https://api.github.com/repos/noflo/noflo-objects/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/noflo/noflo-objects/teams","hooks_url":"https://api.github.com/repos/noflo/noflo-objects/hooks","issue_events_url":"https://api.github.com/repos/noflo/noflo-objects/issues/events{/number}","events_url":"https://api.github.com/repos/noflo/noflo-objects/events","assignees_url":"https://api.github.com/repos/noflo/noflo-objects/assignees{/user}","branches_url":"https://api.github.com/repos/noflo/noflo-objects/branches{/branch}","tags_url":"https://api.github.com/repos/noflo/noflo-objects/tags","blobs_url":"https://api.github.com/repos/noflo/noflo-objects/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/noflo/noflo-objects/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/noflo/noflo-objects/git/refs{/sha}","trees_url":"https://api.github.com/repos/noflo/noflo-objects/git/trees{/sha}","statuses_url":"https://api.github.com/repos/noflo/noflo-objects/statuses/{sha}","languages_url":"https://api.github.com/repos/noflo/noflo-objects/languages","stargazers_url":"https://api.github.com/repos/noflo/noflo-objects/stargazers","contributors_url":"https://api.github.com/repos/noflo/noflo-objects/contributors","subscribers_url":"https://api.github.com/repos/noflo/noflo-objects/subscribers","subscription_url":"https://api.github.com/repos/noflo/noflo-objects/subscription","commits_url":"https://api.github.com/repos/noflo/noflo-objects/commits{/sha}","git_commits_url":"https://api.github.com/repos/noflo/noflo-objects/git/commits{/sha}","comments_url":"https://api.github.com/repos/noflo/noflo-objects/comments{/number}","issue_comment_url":"https://api.github.com/repos/noflo/noflo-objects/issues/comments{/number}","contents_url":"https://api.github.com/repos/noflo/noflo-objects/contents/{+path}","compare_url":"https://api.github.com/repos/noflo/noflo-objects/compare/{base}...{head}","merges_url":"https://api.github.com/repos/noflo/noflo-objects/merges","archive_url":"https://api.github.com/repos/noflo/noflo-objects/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/noflo/noflo-objects/downloads","issues_url":"https://api.github.com/repos/noflo/noflo-objects/issues{/number}","pulls_url":"https://api.github.com/repos/noflo/noflo-objects/pulls{/number}","milestones_url":"https://api.github.com/repos/noflo/noflo-objects/milestones{/number}","notifications_url":"https://api.github.com/repos/noflo/noflo-objects/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/noflo/noflo-objects/labels{/name}","releases_url":"https://api.github.com/repos/noflo/noflo-objects/releases{/id}","deployments_url":"https://api.github.com/repos/noflo/noflo-objects/deployments","created_at":"2013-04-21T18:51:13Z","updated_at":"2016-02-16T23:12:07Z","pushed_at":"2016-06-10T17:51:33Z","git_url":"git://github.com/noflo/noflo-objects.git","ssh_url":"git@github.com:noflo/noflo-objects.git","clone_url":"https://github.com/noflo/noflo-objects.git","svn_url":"https://github.com/noflo/noflo-objects","homepage":"","size":223,"stargazers_count":5,"watchers_count":5,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":21,"forks":15,"open_issues":21,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/79"},"html":{"href":"https://github.com/noflo/noflo-objects/pull/79"},"issue":{"href":"https://api.github.com/repos/noflo/noflo-objects/issues/79"},"comments":{"href":"https://api.github.com/repos/noflo/noflo-objects/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/noflo/noflo-objects/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/noflo/noflo-objects/statuses/a2bb246930c319d0701d3f02e8d6d41150272c0b"}}}}
{"actor":{"display_login":"bergie"}}