{"action":"created","issue":{"url":"https://api.github.com/repos/mweststrate/immer/issues/258","repository_url":"https://api.github.com/repos/mweststrate/immer","labels_url":"https://api.github.com/repos/mweststrate/immer/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/mweststrate/immer/issues/258/comments","events_url":"https://api.github.com/repos/mweststrate/immer/issues/258/events","html_url":"https://github.com/mweststrate/immer/pull/258","id":386242384,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1MDMwODA5","number":258,"title":"feat: add `Immer` class","user":{"login":"aleclarson","id":1925840,"node_id":"MDQ6VXNlcjE5MjU4NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/1925840?v=4","gravatar_id":"","url":"https://api.github.com/users/aleclarson","html_url":"https://github.com/aleclarson","followers_url":"https://api.github.com/users/aleclarson/followers","following_url":"https://api.github.com/users/aleclarson/following{/other_user}","gists_url":"https://api.github.com/users/aleclarson/gists{/gist_id}","starred_url":"https://api.github.com/users/aleclarson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleclarson/subscriptions","organizations_url":"https://api.github.com/users/aleclarson/orgs","repos_url":"https://api.github.com/users/aleclarson/repos","events_url":"https://api.github.com/users/aleclarson/events{/privacy}","received_events_url":"https://api.github.com/users/aleclarson/received_events","type":"User","site_admin":false},"labels":[{"id":792492154,"node_id":"MDU6TGFiZWw3OTI0OTIxNTQ=","url":"https://api.github.com/repos/mweststrate/immer/labels/PR%20action:%20review","name":"PR action: review","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mweststrate/immer/milestones/7","html_url":"https://github.com/mweststrate/immer/milestone/7","labels_url":"https://api.github.com/repos/mweststrate/immer/milestones/7/labels","id":3861532,"node_id":"MDk6TWlsZXN0b25lMzg2MTUzMg==","number":7,"title":"1.9.0","description":null,"creator":{"login":"aleclarson","id":1925840,"node_id":"MDQ6VXNlcjE5MjU4NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/1925840?v=4","gravatar_id":"","url":"https://api.github.com/users/aleclarson","html_url":"https://github.com/aleclarson","followers_url":"https://api.github.com/users/aleclarson/followers","following_url":"https://api.github.com/users/aleclarson/following{/other_user}","gists_url":"https://api.github.com/users/aleclarson/gists{/gist_id}","starred_url":"https://api.github.com/users/aleclarson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleclarson/subscriptions","organizations_url":"https://api.github.com/users/aleclarson/orgs","repos_url":"https://api.github.com/users/aleclarson/repos","events_url":"https://api.github.com/users/aleclarson/events{/privacy}","received_events_url":"https://api.github.com/users/aleclarson/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2018-11-30T15:48:26Z","updated_at":"2018-11-30T15:49:36Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2018-11-30T15:49:36Z","updated_at":"2018-11-30T16:53:46Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/mweststrate/immer/pulls/258","html_url":"https://github.com/mweststrate/immer/pull/258","diff_url":"https://github.com/mweststrate/immer/pull/258.diff","patch_url":"https://github.com/mweststrate/immer/pull/258.patch"},"body":"Closes #254 \r\n\r\nEvery instance of the `Immer` class provides a bound `produce` function. As explained in #254, this class makes room for advanced configuration (if we need it) and allows for interop between Immer-using libraries that have different needs.\r\n\r\nI took the time to refactor while I was implementing this, so the diff may look\r\nmore overwhelming than it is. :)\r\n\r\n### Summary\r\n\r\n1. Renamed `immer.js` to `index.js` so the `Immer` class can have `immer.js`\r\n\r\n2. Use the word \"draft\" in place of \"proxy\" in most places, because \"draft\" is\r\n   a higher level of abstraction. It also makes sense to use the same semantics\r\n   both internally and externally.\r\n\r\n3. Moved `finalize` logic to the `Immer` class\r\n\r\n4. Inlined the `freeze` function as only one callsite existed\r\n\r\n5. Inlined the `createState` functions in both `proxy.js` and `es5.js`\r\n\r\n6. Extract repeated code from `produceEs5` and `produceProxy` (which have since\r\n   been removed) into the `Immer` class\r\n\r\n7. The `es5.js` and `proxy.js` modules now have different exports:\r\n    - `scopes`: an array of nested `produce` calls, where each value is an array\r\n      of unrevoked proxies\r\n    - `currentScope()`: shortcut for getting the last value of the `scopes` array\r\n    - `createDraft()`: a renamed `createProxy` with the arguments swapped\r\n    - `willFinalize()`: called right after the recipe function returns (only\r\n      used by ES5 proxies)\r\n\r\n8. Changed some \"draft state\" properties:\r\n    - removed `hasCopy` in ES5 state (checking for truthiness of `copy` does the job)\r\n    - renamed `proxy` to `draft` in ES5 state\r\n    - renamed `finished` to `revoked` in ES5 state\r\n    - renamed `proxies` to `drafts` in Proxy state\r\n    - added `revoke` method (called by the `Immer` class)\r\n    - added `draft` property to Proxy state\r\n    - use null literals instead of undefined (for brevity)\r\n\r\n9. Delay creation of `patches` and `inversePatches` arrays until the recipe\r\n   function returns. This avoids array allocations when a rollback is performed\r\n   by throwing.\r\n\r\n10. Simplified `generatePatches` by removing the last two arguments, since they\r\n    can be obtained from the `state` argument."},"comment":{"url":"https://api.github.com/repos/mweststrate/immer/issues/comments/443266904","html_url":"https://github.com/mweststrate/immer/pull/258#issuecomment-443266904","issue_url":"https://api.github.com/repos/mweststrate/immer/issues/258","id":443266904,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzI2NjkwNA==","user":{"login":"coveralls","id":2354108,"node_id":"MDQ6VXNlcjIzNTQxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2018-11-30T16:53:46Z","updated_at":"2018-11-30T16:53:46Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/20386750/badge)](https://coveralls.io/builds/20386750)\n\nCoverage decreased (-0.7%) to 96.931% when pulling **c1a548b7ae1d56d6d6961d2153a1231df8048bf9 on aleclarson:factory** into **d157d7a7d32c54ae0af27cb2a3c96e1e596cf537 on mweststrate:master**.\n"}}
{"actor":{"display_login":"coveralls"}}