{"action":"created","issue":{"url":"https://api.github.com/repos/janearc/deep-grep/issues/19","labels_url":"https://api.github.com/repos/janearc/deep-grep/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/janearc/deep-grep/issues/19/comments","events_url":"https://api.github.com/repos/janearc/deep-grep/issues/19/events","html_url":"https://github.com/janearc/deep-grep/issues/19","id":58065431,"number":19,"title":"Deep clone based on a match","user":{"login":"am-a","id":627367,"avatar_url":"https://avatars.githubusercontent.com/u/627367?v=3","gravatar_id":"","url":"https://api.github.com/users/am-a","html_url":"https://github.com/am-a","followers_url":"https://api.github.com/users/am-a/followers","following_url":"https://api.github.com/users/am-a/following{/other_user}","gists_url":"https://api.github.com/users/am-a/gists{/gist_id}","starred_url":"https://api.github.com/users/am-a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/am-a/subscriptions","organizations_url":"https://api.github.com/users/am-a/orgs","repos_url":"https://api.github.com/users/am-a/repos","events_url":"https://api.github.com/users/am-a/events{/privacy}","received_events_url":"https://api.github.com/users/am-a/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/janearc/deep-grep/labels/nice-to-have","name":"nice-to-have","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/janearc/deep-grep/milestones/2","labels_url":"https://api.github.com/repos/janearc/deep-grep/milestones/2/labels","id":987089,"number":2,"title":"0.5.0","description":"","creator":{"login":"janearc","id":777319,"avatar_url":"https://avatars.githubusercontent.com/u/777319?v=3","gravatar_id":"","url":"https://api.github.com/users/janearc","html_url":"https://github.com/janearc","followers_url":"https://api.github.com/users/janearc/followers","following_url":"https://api.github.com/users/janearc/following{/other_user}","gists_url":"https://api.github.com/users/janearc/gists{/gist_id}","starred_url":"https://api.github.com/users/janearc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janearc/subscriptions","organizations_url":"https://api.github.com/users/janearc/orgs","repos_url":"https://api.github.com/users/janearc/repos","events_url":"https://api.github.com/users/janearc/events{/privacy}","received_events_url":"https://api.github.com/users/janearc/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2015-02-19T17:31:46Z","updated_at":"2015-02-19T17:34:22Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-02-18T13:08:51Z","updated_at":"2015-02-19T20:08:50Z","closed_at":null,"body":"Can we have a deep clone based on a match\r\n\r\ne.g.\r\n\r\n    var haystack = [\r\n        'zebra', 'lion', [\r\n            'tiger', 'unicorn', 'emperor penguin'\r\n        ],\r\n        'leprechaun',\r\n        'cockerel'\r\n    ];\r\n\r\n    var needles  = dg.pickDeep( list, function (t) {\r\n        if (new RegExp( ('(unicorn|leprechaun)s?' ).test(t))) return true\r\n    } );\r\n\r\nyields:\r\n\r\n    ['leprechaun',['unicorn']];"},"comment":{"url":"https://api.github.com/repos/janearc/deep-grep/issues/comments/75126153","html_url":"https://github.com/janearc/deep-grep/issues/19#issuecomment-75126153","issue_url":"https://api.github.com/repos/janearc/deep-grep/issues/19","id":75126153,"user":{"login":"janearc","id":777319,"avatar_url":"https://avatars.githubusercontent.com/u/777319?v=3","gravatar_id":"","url":"https://api.github.com/users/janearc","html_url":"https://github.com/janearc","followers_url":"https://api.github.com/users/janearc/followers","following_url":"https://api.github.com/users/janearc/following{/other_user}","gists_url":"https://api.github.com/users/janearc/gists{/gist_id}","starred_url":"https://api.github.com/users/janearc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janearc/subscriptions","organizations_url":"https://api.github.com/users/janearc/orgs","repos_url":"https://api.github.com/users/janearc/repos","events_url":"https://api.github.com/users/janearc/events{/privacy}","received_events_url":"https://api.github.com/users/janearc/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T20:08:50Z","updated_at":"2015-02-19T20:08:50Z","body":"Well, my plan is actually to remove `sync` and `async` and have the primary interface to dg be `deeply` (so `{ 'return-promise': true }` gets you a promise instead of the value when you're done grepping…). The problem with separate methods is that, if you look at the code, there is not a lot of stuff happening in `deeply` itself; there's a lot of traversal into other places (figuring out what to do with nested structures; testing for expressions vs functions; figuring out what *is* a nested structure; et cetera).\r\n\r\nSo having a new method name is really kind of just window dressing on the guts behind the scenes. I see it as being no real different from a `clone-structure` flag; furthermore, what if you want to `clone-structure` but you only want to `clone-structure` when `'check-values': true`?\r\n\r\nIt's a design decision; I don't have a real preference in terms of \"justified by it being better.\" My feeling, my *bias* on this, is to follow the lead of Unix; I use `grep -E` preferentially over `egrep`, I use `--long-arguments` preferentially over short, and so on. The \"convention\" (such as it is), for me, is call-the-thing-you're-calling and supply-sufficient-arguments-to-do-what-you-want.\r\n\r\nDisclaimer: I'm a Unix admin first, a perl and shell programmer second, and somewhere after that I am a data-modeling and javascripty person. I could be Doing This Wrong."}}