{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/polylabel/issues/10","repository_url":"https://api.github.com/repos/mapbox/polylabel","labels_url":"https://api.github.com/repos/mapbox/polylabel/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/polylabel/issues/10/comments","events_url":"https://api.github.com/repos/mapbox/polylabel/issues/10/events","html_url":"https://github.com/mapbox/polylabel/pull/10","id":177314762,"number":10,"title":"Add default module export to support ES6 Typescript","user":{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars.githubusercontent.com/u/550895?v=3","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-15T23:28:46Z","updated_at":"2016-09-16T10:49:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mapbox/polylabel/pulls/10","html_url":"https://github.com/mapbox/polylabel/pull/10","diff_url":"https://github.com/mapbox/polylabel/pull/10.diff","patch_url":"https://github.com/mapbox/polylabel/pull/10.patch"},"body":"### Typescript \r\n\r\nThis enables a more ES6 import syntax used in Typescript.\r\n\r\n**current**\r\n\r\n```javascript\r\nimport * as polylabel from 'polylabel'\r\n```\r\n\r\n**with default module**\r\n\r\n```javascript\r\nimport polylabel from 'polylabel'\r\n```\r\n\r\n### Babel\r\n\r\nBabel does compile the default module without this addition, however it does some hacks in the background.\r\n\r\n**sample code**\r\n```javascript\r\nimport polylabel from 'polylabel';\r\n\r\nconst polygon = [[[3116,3071],[3118,3068],[3108,3102],[3751,927]]]\r\npolylabel(polygon)\r\n```\r\n\r\n**babel converts into**\r\n```javascript\r\nvar _polylabel = require('polylabel');\r\n\r\nvar _polylabel2 = _interopRequireDefault(_polylabel);\r\n\r\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\r\nvar polygon = [[[3116, 3071], [3118, 3068], [3108, 3102], [3751, 927]]]; \r\n(0, _polylabel2.default)(polygon);\r\n```"},"comment":{"url":"https://api.github.com/repos/mapbox/polylabel/issues/comments/247572055","html_url":"https://github.com/mapbox/polylabel/pull/10#issuecomment-247572055","issue_url":"https://api.github.com/repos/mapbox/polylabel/issues/10","id":247572055,"user":{"login":"mourner","id":25395,"avatar_url":"https://avatars.githubusercontent.com/u/25395?v=3","gravatar_id":"","url":"https://api.github.com/users/mourner","html_url":"https://github.com/mourner","followers_url":"https://api.github.com/users/mourner/followers","following_url":"https://api.github.com/users/mourner/following{/other_user}","gists_url":"https://api.github.com/users/mourner/gists{/gist_id}","starred_url":"https://api.github.com/users/mourner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mourner/subscriptions","organizations_url":"https://api.github.com/users/mourner/orgs","repos_url":"https://api.github.com/users/mourner/repos","events_url":"https://api.github.com/users/mourner/events{/privacy}","received_events_url":"https://api.github.com/users/mourner/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T10:49:21Z","updated_at":"2016-09-16T10:49:21Z","body":"Nice! Is this now a common pattern? I didn't see it before in ES5 JS libraries. Also wondering how Babel code looks after the change."}}
{"actor":{"display_login":"mourner"}}