{"id":15313873,"url":"https://github.com/itsdouges/function-batch","last_synced_at":"2026-01-07T01:33:40.246Z","repository":{"id":57242940,"uuid":"87807325","full_name":"itsdouges/function-batch","owner":"itsdouges","description":"📦 Higher order function that will batch all calls to the wrapped function over a time period, and then call the wrapped function once with all args.","archived":false,"fork":false,"pushed_at":"2017-07-05T23:59:18.000Z","size":117,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T05:20:47.887Z","etag":null,"topics":["batch","batch-function","es2015","es6","function","function-batch","function-to-promise","javascript"],"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/itsdouges.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-04-10T12:19:23.000Z","updated_at":"2019-02-10T00:03:50.000Z","dependencies_parsed_at":"2022-09-15T00:50:43.660Z","dependency_job_id":null,"html_url":"https://github.com/itsdouges/function-batch","commit_stats":null,"previous_names":["madou/function-batch"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Ffunction-batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Ffunction-batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Ffunction-batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Ffunction-batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsdouges","download_url":"https://codeload.github.com/itsdouges/function-batch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245896676,"owners_count":20690315,"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":["batch","batch-function","es2015","es6","function","function-batch","function-to-promise","javascript"],"created_at":"2024-10-01T08:43:29.733Z","updated_at":"2026-01-07T01:33:40.180Z","avatar_url":"https://github.com/itsdouges.png","language":"JavaScript","readme":"# [function-batch](https://github.com/madou/function-batch)\n\n[![NPM version](http://img.shields.io/npm/v/function-batch.svg?style=flat-square)](https://www.npmjs.com/package/function-batch)\n[![NPM downloads](http://img.shields.io/npm/dm/function-batch.svg?style=flat-square)](https://www.npmjs.com/package/function-batch)\n[![Build Status](http://img.shields.io/travis/madou/function-batch/master.svg?style=flat-square)](https://travis-ci.org/madou/function-batch)\n[![codecov](https://codecov.io/gh/madou/function-batch/branch/master/graph/badge.svg)](https://codecov.io/gh/madou/function-batch)\n[![Dependency Status](http://img.shields.io/david/madou/function-batch.svg?style=flat-square)](https://david-dm.org/madou/function-batch)\n\n\u003e Higher order function that will batch all calls to the wrapped function over a debounce, and then call the wrapped function once.\n\n## How to Install\n\n```sh\nnpm install function-batch\n```\n\n## Usage\n\n```javascript\nimport functionBatch from 'function-batch';\n\nconst returnArr = (arr) =\u003e arr;\nconst returnArrBatched = functionBatch(returnArr);\n\nconst value = Promise.all([\n  returnArrBatched([1]);\n  returnArrBatched([2]);\n  returnArrBatched([3]);\n  returnArrBatched([4]);\n])\n.then(([a, b, c, d]) =\u003e {\n// All resolve with the same value.\n// a = [1, 2, 3, 4]\n// b = [1, 2, 3, 4]\n// c = [1, 2, 3, 4]\n// d = [1, 2, 3, 4]\n});\n```\n\nCurrently `function-batch` only supports batching up arrays.\nSupport for different kinds of args will be added if requested!\n\n## Api\n\n### function: functionBatch(func, wait, options): Promise\u003c*\u003e\n\n| param   | type     | required |\n|---------|----------|----------|\n| func    | Function | yes      |\n| wait    | number   | yes      |\n| options | Options  | no       |\n\n### object: Options\n\n| param    | type    | required |\n|----------|---------|----------|\n| leading  | boolean | no       |\n| trailing | boolean | no       |\n| maxWait  | number  | no       |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdouges%2Ffunction-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsdouges%2Ffunction-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdouges%2Ffunction-batch/lists"}