{"id":15816455,"url":"https://github.com/cachecontrol/promise-any-series","last_synced_at":"2025-10-14T09:16:02.204Z","repository":{"id":30612590,"uuid":"34167891","full_name":"CacheControl/promise-any-series","owner":"CacheControl","description":"Execute promises in series, testing if any of the results satisfies a condition.","archived":false,"fork":false,"pushed_at":"2015-10-26T00:19:30.000Z","size":156,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T04:12:15.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/CacheControl.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":"2015-04-18T14:01:12.000Z","updated_at":"2025-08-30T23:19:52.000Z","dependencies_parsed_at":"2022-08-19T15:40:31.137Z","dependency_job_id":null,"html_url":"https://github.com/CacheControl/promise-any-series","commit_stats":null,"previous_names":["cdhamm/promise-any-series"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CacheControl/promise-any-series","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CacheControl%2Fpromise-any-series","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CacheControl%2Fpromise-any-series/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CacheControl%2Fpromise-any-series/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CacheControl%2Fpromise-any-series/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CacheControl","download_url":"https://codeload.github.com/CacheControl/promise-any-series/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CacheControl%2Fpromise-any-series/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018503,"owners_count":26086383,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-05T05:03:59.947Z","updated_at":"2025-10-14T09:16:02.188Z","avatar_url":"https://github.com/CacheControl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Promise Any Series\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)\n\nGiven an array of methods that return promises, execute in series and return true if any satisfy a test.\n\nThis library is useful when having a set of prioritized promises to check, and you'd like to test the fast(cheap) calls first, short circuiting after the first one to pass a test.\n\nFor example, if you needed to check several conditions, involving synchronous code(fast), local database calls(less fast), and third party services(slow), you'd want to execute the fast one first, followed by the slower ones, and so forth.\n\n## Installation\n```$ npm install promise-any-series```\n\n## Basic Usage\n\n```javascript\nvar anySeries = require('promise-any-series');\n\nvar superFast = function() {\n  return new Promise(function(resolve, reject) {\n    console.log('superFast ran!');\n    resolve('foo');\n  });\n};\n\nvar sortaSlow = function() {\n  return new Promise(function(resolve, reject) {\n    console.log('sortaSlow ran!');\n    resolve(100);\n  });\n};\n\nvar superDuperSlow = function() {\n  return new Promise(function(resolve, reject) {\n    console.log('superDuperSlow ran!');\n    resolve('bar');\n  });\n};\n\nanySeries([superFast, sortaSlow, superDuperSlow], function(value) {\n  return typeof value == 'number'; //the first promise to pass the test will immediately resolve true\n}).then( (result) =\u003e {\n  console.log(result);\n});\n```\nThis will print:\n```javascript\nsuperFast ran!     //does not pass test\nsortaSlow ran!     //passes test\ntrue               //note that superDuperSlow did not run\n```\n\n## Inputs\nEmpty arrays or failing to provide a valid callback immediately resolve as false.\n```javascript\nanySeries([]).then(function(data) {\n  console.log(results); //false\n});\n```\nThis will print:\n```javascript\nfalse\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachecontrol%2Fpromise-any-series","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcachecontrol%2Fpromise-any-series","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachecontrol%2Fpromise-any-series/lists"}