{"id":23663428,"url":"https://github.com/eyolas/promise-auto2","last_synced_at":"2025-12-06T09:30:26.748Z","repository":{"id":57331269,"uuid":"49026440","full_name":"eyolas/promise-auto2","owner":"eyolas","description":"async's .auto() for promises","archived":false,"fork":false,"pushed_at":"2016-02-16T11:54:14.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T15:05:28.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eyolas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-04T22:14:17.000Z","updated_at":"2017-03-27T02:10:54.000Z","dependencies_parsed_at":"2022-08-29T10:01:09.868Z","dependency_job_id":null,"html_url":"https://github.com/eyolas/promise-auto2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fpromise-auto2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fpromise-auto2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fpromise-auto2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fpromise-auto2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyolas","download_url":"https://codeload.github.com/eyolas/promise-auto2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239662734,"owners_count":19676435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-29T05:28:20.252Z","updated_at":"2025-12-06T09:30:21.451Z","avatar_url":"https://github.com/eyolas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/eyolas/promise-auto2.svg?branch=master)](https://travis-ci.org/eyolas/promise-auto2)\n\n# Promise-auto2\n\nasync's .auto() for promises\n\n## Install\n\n```sh\nnpm install promise-auto2\n```\n\n## Usage\n\n### auto(tasks, [Promise])\n\n__Arguments__\n\n* `tasks` - An object. Each of its properties is either a function or an array of\n  requirements, with the function itself the last item in the array. The object's key\n  of a property serves as the name of the task defined by that property,\n  i.e. can be used when specifying requirements for other tasks.\n  The function receives one argument: a `results` object, containing the results of\n  the previously executed functions.\n* `Promise` - Using another Promise implementation\n\n## sample\n```js\nvar PromiseAuto = require('promise-auto2');\nPromiseAuto({\n  get_data: function(){\n    console.log('in get_data');\n    // async code to get some data\n    return ['data', 'converted to array'];\n  },\n  make_folder: function(){\n    console.log('in make_folder');\n    // async code to create a directory to store a file in\n    // this is run at the same time as getting the data\n    // return 'folder';\n    return new Promise((resolve) =\u003e {\n      setTimeout(function() {\n        resolve('folder');\n      }, 5000);\n    });\n  },\n  write_file: ['get_data', 'make_folder', function(results){\n    console.log('in write_file', JSON.stringify(results), results);\n    // once there is some data and the directory exists,\n    // write the data to a file in the directory\n    return 'filename';\n  }],\n  email_link: ['write_file', function(results){\n    console.log('in email_link', JSON.stringify(results), results);\n    // once the file is written let's email a link to it...\n    // results.write_file contains the filename returned by write_file.\n    return {'file':results.write_file, 'email':'user@example.com'};\n  }]\n})\n.then(function(results) {\n  console.log('results = ', results);\n})\n.catch(function(err) {\n    console.log('err = ', err);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyolas%2Fpromise-auto2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyolas%2Fpromise-auto2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyolas%2Fpromise-auto2/lists"}