{"action":"closed","issue":{"url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/issues/31","labels_url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/issues/31/comments","events_url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/issues/31/events","html_url":"https://github.com/AmpersandJS/ampersand-subcollection/issues/31","id":53833706,"number":31,"title":"transform?","user":{"login":"contra","id":425716,"avatar_url":"https://avatars.githubusercontent.com/u/425716?v=3","gravatar_id":"","url":"https://api.github.com/users/contra","html_url":"https://github.com/contra","followers_url":"https://api.github.com/users/contra/followers","following_url":"https://api.github.com/users/contra/following{/other_user}","gists_url":"https://api.github.com/users/contra/gists{/gist_id}","starred_url":"https://api.github.com/users/contra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contra/subscriptions","organizations_url":"https://api.github.com/users/contra/orgs","repos_url":"https://api.github.com/users/contra/repos","events_url":"https://api.github.com/users/contra/events{/privacy}","received_events_url":"https://api.github.com/users/contra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/labels/enhancement","name":"enhancement","color":"207de5"},{"url":"https://api.github.com/repos/AmpersandJS/ampersand-subcollection/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2015-01-09T04:53:55Z","updated_at":"2015-04-01T18:38:11Z","closed_at":"2015-04-01T18:38:11Z","body":"There is a good way to filter out items in a collection based on a function, but what about transforming? This could be done on parent collection update or even done lazily on access.\r\n\r\nThis would basically be like creating a new view of a collection's data. A basic example of how this could look:\r\n\r\n```js\r\nvar Movies = new Collection({movie object whatever});\r\n\r\nvar MoviesWithPeople = new SubCollection(Movies, {\r\n  // map takes in a model, returns a model\r\n  transform: function(movie){\r\n    var newMovie = transformMovieSomehow(movie);\r\n    return newMovie;\r\n  }\r\n});\r\n```"}}