{"action":"created","issue":{"url":"https://api.github.com/repos/ericelliott/stampit/issues/40","labels_url":"https://api.github.com/repos/ericelliott/stampit/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/ericelliott/stampit/issues/40/comments","events_url":"https://api.github.com/repos/ericelliott/stampit/issues/40/events","html_url":"https://github.com/ericelliott/stampit/issues/40","id":54158755,"number":40,"title":"Suggestion Feature. 'compose' method with deep extend.","user":{"login":"raabbajam","id":8508709,"avatar_url":"https://avatars.githubusercontent.com/u/8508709?v=3","gravatar_id":"","url":"https://api.github.com/users/raabbajam","html_url":"https://github.com/raabbajam","followers_url":"https://api.github.com/users/raabbajam/followers","following_url":"https://api.github.com/users/raabbajam/following{/other_user}","gists_url":"https://api.github.com/users/raabbajam/gists{/gist_id}","starred_url":"https://api.github.com/users/raabbajam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raabbajam/subscriptions","organizations_url":"https://api.github.com/users/raabbajam/orgs","repos_url":"https://api.github.com/users/raabbajam/repos","events_url":"https://api.github.com/users/raabbajam/events{/privacy}","received_events_url":"https://api.github.com/users/raabbajam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-13T07:24:53Z","updated_at":"2015-01-14T00:20:15Z","closed_at":null,"body":"Can we use deep recursive copy / extend on 'compose' method?\r\nRight now it doesn't. Can't we do this?\r\n```javascript\r\nvar Validator = require('../libs/Validator');\r\n// Validator has state.rules.flight = { ori: 'required|size:3', dst: 'required|size:3' }\r\n// I want to create another factory with \r\n//  rules.flight = { ori: 'size:3', dst: 'required|size:3', rute: 'required' }; \r\n//  with 'ori' now is not required and 'rute' is required\r\ndescribe('#compose with other states', function() {\r\n\t\tvar _states = {\r\n\t\t\trules: {\r\n\t\t\t\tflight: {\r\n\t\t\t\t\tori: 'size:3',\r\n                    rute: 'required',\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tvar states = stampit()\r\n\t\t\t.state(_states);\r\n\t\tvar Child = stampit.compose(Validator, states);\r\n\t\tit('should fails rules', function(done) {\r\n            var query2 = {\r\n                action: 'flight'\r\n            };\r\n\t\t\tvar child2 = Child({\r\n\t\t\t\tquery: query2\r\n\t\t\t});\r\n\t\t\tvar _query2 = child2.run();\r\n            console.log(Validator.fixed.state.rules.flight); // { ori: 'required|size:3', dst: 'required|size:3' }\r\n            console.log(Child.fixed.state.rules.flight); // { ori: 'size:3', rute: 'required' }\r\n            // if we use deep recursive extend, rules.flight should be { ori: 'size:3', dst: 'required|size:3', rute: 'required' }\r\n\t\t\texpect(_query2.dst)\r\n\t\t\t\t.to.exist; // expecting query.dst to exist because it filled with error message that dst is still required\r\n\t\t\tdone();\r\n\t\t});\r\n```\r\n\r\non console:\r\n``` \r\n1) Base validator #compose with other states should fails rules:\r\n     AssertionError: expected undefined to exist\r\n```"},"comment":{"url":"https://api.github.com/repos/ericelliott/stampit/issues/comments/69848199","html_url":"https://github.com/ericelliott/stampit/issues/40#issuecomment-69848199","issue_url":"https://api.github.com/repos/ericelliott/stampit/issues/40","id":69848199,"user":{"login":"ericelliott","id":364727,"avatar_url":"https://avatars.githubusercontent.com/u/364727?v=3","gravatar_id":"","url":"https://api.github.com/users/ericelliott","html_url":"https://github.com/ericelliott","followers_url":"https://api.github.com/users/ericelliott/followers","following_url":"https://api.github.com/users/ericelliott/following{/other_user}","gists_url":"https://api.github.com/users/ericelliott/gists{/gist_id}","starred_url":"https://api.github.com/users/ericelliott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericelliott/subscriptions","organizations_url":"https://api.github.com/users/ericelliott/orgs","repos_url":"https://api.github.com/users/ericelliott/repos","events_url":"https://api.github.com/users/ericelliott/events{/privacy}","received_events_url":"https://api.github.com/users/ericelliott/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T00:20:15Z","updated_at":"2015-01-14T00:20:15Z","body":"Oh yeah, you are right. =) I made a conscious decision not to traverse the entire object hierarchy so that you could pass along things like reference to request / response objects. I think we can open that for debate, but it will be a backward-breaking change, so we'd have to do a 2.0 release if we decide to change it... it's going to effect all the stamps that rely on reference behavior."}}