{"action":"created","issue":{"url":"https://api.github.com/repos/substack/node-mkdirp/issues/86","labels_url":"https://api.github.com/repos/substack/node-mkdirp/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/substack/node-mkdirp/issues/86/comments","events_url":"https://api.github.com/repos/substack/node-mkdirp/issues/86/events","html_url":"https://github.com/substack/node-mkdirp/issues/86","id":62172908,"number":86,"title":"Add Promise support","user":{"login":"astorije","id":113730,"avatar_url":"https://avatars.githubusercontent.com/u/113730?v=3","gravatar_id":"","url":"https://api.github.com/users/astorije","html_url":"https://github.com/astorije","followers_url":"https://api.github.com/users/astorije/followers","following_url":"https://api.github.com/users/astorije/following{/other_user}","gists_url":"https://api.github.com/users/astorije/gists{/gist_id}","starred_url":"https://api.github.com/users/astorije/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astorije/subscriptions","organizations_url":"https://api.github.com/users/astorije/orgs","repos_url":"https://api.github.com/users/astorije/repos","events_url":"https://api.github.com/users/astorije/events{/privacy}","received_events_url":"https://api.github.com/users/astorije/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-03-16T18:42:08Z","updated_at":"2015-10-28T20:29:22Z","closed_at":"2015-10-28T07:58:18Z","body":"Would you be open to support [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)?\r\n\r\nEssentially, [your first example in the README](https://github.com/substack/node-mkdirp#powjs) would become:\r\n\r\n```js\r\nvar mkdirp = require('mkdirp');\r\nvar creation = mkdirp('/tmp/foo/bar/baz');\r\n// [...]\r\n\r\ncreation\r\n  .then(function () { console.log('pow!'); })\r\n  .catch(console.error);\r\n```\r\n\r\nIn terms of implementation, it could work as follows: if `cb` (as in `mkdirp(dir, opts, cb)`) is provided and is a `function`, it returns nothing and executes `cb` like it does today; otherwise, it returns a Promise.\r\n\r\nHow does that sound?"},"comment":{"url":"https://api.github.com/repos/substack/node-mkdirp/issues/comments/151980448","html_url":"https://github.com/substack/node-mkdirp/issues/86#issuecomment-151980448","issue_url":"https://api.github.com/repos/substack/node-mkdirp/issues/86","id":151980448,"user":{"login":"mattdesl","id":1383811,"avatar_url":"https://avatars.githubusercontent.com/u/1383811?v=3","gravatar_id":"","url":"https://api.github.com/users/mattdesl","html_url":"https://github.com/mattdesl","followers_url":"https://api.github.com/users/mattdesl/followers","following_url":"https://api.github.com/users/mattdesl/following{/other_user}","gists_url":"https://api.github.com/users/mattdesl/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdesl/subscriptions","organizations_url":"https://api.github.com/users/mattdesl/orgs","repos_url":"https://api.github.com/users/mattdesl/repos","events_url":"https://api.github.com/users/mattdesl/events{/privacy}","received_events_url":"https://api.github.com/users/mattdesl/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T20:29:22Z","updated_at":"2015-10-28T20:29:22Z","body":"> Today all modules can (and should) use Promise.\r\n\r\nThis is not always a good idea. Expecting `Promise` introduces a peer-dependency on polyfills for consumers in legacy environments, which adds a deal of bloat/opinion/complexity to an otherwise small and simple module. This particularly affects frontend developers using npm.\r\n\r\nThere is also something to be said about stability and a frozen API. With 14 million downloads a month and countless dependents, it is better just to leave a module as-is rather than overturn its API for some slight syntax sugar."}}