{"action":"created","issue":{"url":"https://api.github.com/repos/zloirock/core-js/issues/251","repository_url":"https://api.github.com/repos/zloirock/core-js","labels_url":"https://api.github.com/repos/zloirock/core-js/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/zloirock/core-js/issues/251/comments","events_url":"https://api.github.com/repos/zloirock/core-js/issues/251/events","html_url":"https://github.com/zloirock/core-js/issues/251","id":182608269,"number":251,"title":"Relationship between `_library` and `USE_NATIVE` in es6.promise.js","user":{"login":"taylor1791","id":555003,"avatar_url":"https://avatars.githubusercontent.com/u/555003?v=3","gravatar_id":"","url":"https://api.github.com/users/taylor1791","html_url":"https://github.com/taylor1791","followers_url":"https://api.github.com/users/taylor1791/followers","following_url":"https://api.github.com/users/taylor1791/following{/other_user}","gists_url":"https://api.github.com/users/taylor1791/gists{/gist_id}","starred_url":"https://api.github.com/users/taylor1791/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylor1791/subscriptions","organizations_url":"https://api.github.com/users/taylor1791/orgs","repos_url":"https://api.github.com/users/taylor1791/repos","events_url":"https://api.github.com/users/taylor1791/events{/privacy}","received_events_url":"https://api.github.com/users/taylor1791/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-12T19:08:54Z","updated_at":"2016-10-12T20:55:29Z","closed_at":"2016-10-12T20:35:40Z","body":"I was debugging some of our code and noticed that some files had the native `Promise.resolve` and others had the implementation in `es6.promise.js`. Furthermore, `Promise.reject` was the native implementation in both places. An investigation led me to find this bit of code.\r\n\r\n```\r\n$export($export.S + $export.F * !USE_NATIVE, PROMISE, {\r\n  // 25.4.4.5 Promise.reject(r)\r\n  ...\r\n});\r\n$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {\r\n  // 25.4.4.6 Promise.resolve(x)\r\n  ...\r\n});\r\n```\r\n\r\nSpecifically, it appears that `Promise.resolve` is always polyfilled regardless of the USE_NATIVE flag since `LIBRARY` is always true. This was unexpected to me.\r\n\r\nWhat is the motivation to always polyfill `resolve`, but not necessarily `reject`?\r\n"},"comment":{"url":"https://api.github.com/repos/zloirock/core-js/issues/comments/253336426","html_url":"https://github.com/zloirock/core-js/issues/251#issuecomment-253336426","issue_url":"https://api.github.com/repos/zloirock/core-js/issues/251","id":253336426,"user":{"login":"zloirock","id":2213682,"avatar_url":"https://avatars.githubusercontent.com/u/2213682?v=3","gravatar_id":"","url":"https://api.github.com/users/zloirock","html_url":"https://github.com/zloirock","followers_url":"https://api.github.com/users/zloirock/followers","following_url":"https://api.github.com/users/zloirock/following{/other_user}","gists_url":"https://api.github.com/users/zloirock/gists{/gist_id}","starred_url":"https://api.github.com/users/zloirock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zloirock/subscriptions","organizations_url":"https://api.github.com/users/zloirock/orgs","repos_url":"https://api.github.com/users/zloirock/repos","events_url":"https://api.github.com/users/zloirock/events{/privacy}","received_events_url":"https://api.github.com/users/zloirock/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T20:55:29Z","updated_at":"2016-10-12T20:55:29Z","body":"`library` is a version without global namespace pollution, `require('core-js/library/fn/promise') !== global.Promise` anyway. It's wrapper for preventing pollution and internally uses native `Promise` if it's enough correctly. Why will it not work as expected and why not `Promise.reject`? See the third step of http://www.ecma-international.org/ecma-262/7.0/#sec-promise.resolve"}}
{"actor":{"display_login":"zloirock"}}