{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/backbone/issues/3986","repository_url":"https://api.github.com/repos/jashkenas/backbone","labels_url":"https://api.github.com/repos/jashkenas/backbone/issues/3986/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/backbone/issues/3986/comments","events_url":"https://api.github.com/repos/jashkenas/backbone/issues/3986/events","html_url":"https://github.com/jashkenas/backbone/issues/3986","id":139985535,"number":3986,"title":"Backbone.Model.set support function as a parameter","user":{"login":"asantos00","id":2593480,"avatar_url":"https://avatars.githubusercontent.com/u/2593480?v=3","gravatar_id":"","url":"https://api.github.com/users/asantos00","html_url":"https://github.com/asantos00","followers_url":"https://api.github.com/users/asantos00/followers","following_url":"https://api.github.com/users/asantos00/following{/other_user}","gists_url":"https://api.github.com/users/asantos00/gists{/gist_id}","starred_url":"https://api.github.com/users/asantos00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asantos00/subscriptions","organizations_url":"https://api.github.com/users/asantos00/orgs","repos_url":"https://api.github.com/users/asantos00/repos","events_url":"https://api.github.com/users/asantos00/events{/privacy}","received_events_url":"https://api.github.com/users/asantos00/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jashkenas/backbone/labels/enhancement","name":"enhancement","color":"61b1e6"},{"url":"https://api.github.com/repos/jashkenas/backbone/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-10T19:26:23Z","updated_at":"2016-03-10T20:36:09Z","closed_at":"2016-03-10T20:02:17Z","body":"In a project I'm working I had the need for the Model.set function to support a function as a parameter.\r\nSomething like React does:\r\n\r\n```javascript\r\nsetState(function(previousState, currentProps) {\r\n  return {myInteger: previousState.myInteger + 1};\r\n});\r\n```\r\n\r\nWould it be interesting to implement? If so, I would like to make a PR with that"},"comment":{"url":"https://api.github.com/repos/jashkenas/backbone/issues/comments/195035886","html_url":"https://github.com/jashkenas/backbone/issues/3986#issuecomment-195035886","issue_url":"https://api.github.com/repos/jashkenas/backbone/issues/3986","id":195035886,"user":{"login":"akre54","id":931368,"avatar_url":"https://avatars.githubusercontent.com/u/931368?v=3","gravatar_id":"","url":"https://api.github.com/users/akre54","html_url":"https://github.com/akre54","followers_url":"https://api.github.com/users/akre54/followers","following_url":"https://api.github.com/users/akre54/following{/other_user}","gists_url":"https://api.github.com/users/akre54/gists{/gist_id}","starred_url":"https://api.github.com/users/akre54/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akre54/subscriptions","organizations_url":"https://api.github.com/users/akre54/orgs","repos_url":"https://api.github.com/users/akre54/repos","events_url":"https://api.github.com/users/akre54/events{/privacy}","received_events_url":"https://api.github.com/users/akre54/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T20:36:09Z","updated_at":"2016-03-10T20:36:09Z","body":"It's two sides of the same coin (if you have deep set you have to have deep get). Try a plugin like https://github.com/powmedia/backbone-deep-model or https://github.com/afeld/backbone-nested for your use case. "}}