{"id":18687327,"url":"https://github.com/junosuarez/avec","last_synced_at":"2025-11-08T02:30:32.143Z","repository":{"id":7143293,"uuid":"8440692","full_name":"junosuarez/avec","owner":"junosuarez","description":"node module: some functions for working with promises","archived":false,"fork":false,"pushed_at":"2013-02-28T19:57:54.000Z","size":117,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-15T16:46:14.144Z","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/junosuarez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-26T19:59:15.000Z","updated_at":"2014-07-14T23:25:23.000Z","dependencies_parsed_at":"2022-08-28T13:00:34.056Z","dependency_job_id":null,"html_url":"https://github.com/junosuarez/avec","commit_stats":null,"previous_names":["agilediagnosis/avec"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junosuarez%2Favec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junosuarez%2Favec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junosuarez%2Favec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junosuarez%2Favec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junosuarez","download_url":"https://codeload.github.com/junosuarez/avec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239545349,"owners_count":19656765,"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-11-07T10:32:27.966Z","updated_at":"2025-11-08T02:30:32.077Z","avatar_url":"https://github.com/junosuarez.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# avec\nEventual ES5 array operations using promises\n\n## installation\n\n    $ npm install avec\n\n## usage\n\nThink of it like using native ES5 Array.prototype methods on Promised arrays.\n\n    var documents = getPromisedArrayOfStuffFromDB()\n    avec(documents).forEach(function (document) {\n      console.dir(document)\n    })\n\n    avec(documents)\n      .filter(x)\n      .map(x)\n      .reduce(x)\n      .then(function (aggregate) {\n        console.log('we can string things together')\n        // the neat thing about promises is that there's no `value()`\n        // or finalizer method to call, since each step of the way\n        // returns a valid promises/a `thenable` promise.\n      })\n\n## api\n\n### `avec(promisedCollection)`\n\nBegins a promise chain.\n\n### Supported Array.prototype methods:\n\n`forEach`, `filter`, `map`, `reduce`, `reduceRight`, `every`,\n`some`, `concat`, `reverse`, `sort`, `indexOf`, `lastIndexOf`,\n`shift`, `unshift`, `pop`, `push`, `slice`, `splice`\n\nThe return value for each of these is the a Promise of whatever the return value would be on a synchronous array.\n\n### `avec(promise, continuation)`\n\nlike calling `promise.then(continuation)`, except `continuation`'s `this` is also set to the promise value. This allows for slightly more fluid syntax:\n\n    var document = getDocumentAsPromise(5)\n\n    avec(document, function () {\n      console.log('We got ' + this.title)\n    })\n\nThis is pretty much an ergonomic function I wanted when writing scripts.\n\n### `avec.each(promisedArray, iterator)`, alias `avec.chaque`, `avec.forEach`\n\nLike calling `promise.then(function (val) { val.forEach(iterator) })`, Use when you're expecting an array value that you want to iterate over.\n\n### `avec.map(promisedArray, scalarFunction`\n\nLike calling `promise.then(function (val) { return val.map(scalarFunction) })`. Returns a Promise\u003cArray\u003e\n\n## running the unit tests\n\nIn package root directory:\n\n    $ npm install\n    $ npm test\n\n## contributors\n\njden \u003cjason@denizac.org\u003e\n\n## license\n\nMIT. (c) 2013 Agile Diagnosis \u003chello@agilediagnosis.com\u003e See LICENSE.md","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunosuarez%2Favec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunosuarez%2Favec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunosuarez%2Favec/lists"}