{"id":21831363,"url":"https://github.com/nodef/extra-async-function","last_synced_at":"2026-02-24T08:33:35.929Z","repository":{"id":40714298,"uuid":"277720718","full_name":"nodef/extra-async-function","owner":"nodef","description":"An async function is a function that delivers its result asynchronously (through Promise).","archived":false,"fork":false,"pushed_at":"2025-04-08T17:17:28.000Z","size":391,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T18:27:44.721Z","etag":null,"topics":["apply","arguments","async","attach","attach-right","bind","call","compare","compose","compose-right","contextify","curry","curry-right","debounce","debounce-early","decontextify","extra","function","identity","noop"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-async-function","language":"TypeScript","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/nodef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-07T04:57:52.000Z","updated_at":"2025-04-08T17:17:29.000Z","dependencies_parsed_at":"2024-10-30T20:01:42.311Z","dependency_job_id":null,"html_url":"https://github.com/nodef/extra-async-function","commit_stats":{"total_commits":40,"total_committers":1,"mean_commits":40.0,"dds":0.0,"last_synced_commit":"7f785764b31ff1cf081b368b68ae27949ba34563"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-async-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-async-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-async-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-async-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-async-function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247909134,"owners_count":21016475,"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":["apply","arguments","async","attach","attach-right","bind","call","compare","compose","compose-right","contextify","curry","curry-right","debounce","debounce-early","decontextify","extra","function","identity","noop"],"created_at":"2024-11-27T19:09:59.146Z","updated_at":"2026-02-24T08:33:30.894Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"An [async function] is a function that delivers its [result asynchronously] (through [Promise]).\u003cbr\u003e\n📦 [Node.js](https://www.npmjs.com/package/extra-async-function),\n🌐 [Web](https://www.npmjs.com/package/extra-async-function.web),\n📜 [Files](https://unpkg.com/extra-async-function/),\n📰 [JSDoc](https://nodef.github.io/extra-async-function/),\n📘 [Wiki](https://github.com/nodef/extra-async-function/wiki/).\n\nThis package is an *variant* of [extra-function], and includes methods for\ntransforming *async functions*. The **result** of an async function can be\nmanipulated with [negate]. If a *pure* async function is expensive, its results\ncan **cached** with [memoize]. **Parameters** of a function can be manipulated\nwith [reverse], [spread], [unspread]. [reverse] flips the order of parameters,\n[spread] spreads the first array parameter of a function, and [unspread]\ncombines all parameters into the first parameter (array). If you want some\n**functional behavior**, [compose], [composeRight], [curry], and [curryRight]\ncan be used. [composeRight] is also known as [pipe-forward operator] or\n[function chaining]. If you are unfamiliar, [Haskell] is a great purely\nfunctional language, and there is great [haskell beginner guide] to learn from.\n\nTo control invocation **time** of a function, use [delay]. A function can be\n**rate controlled** with [debounce], [debounceEarly], [throttle],\n[throttleEarly]. [debounce] and [debounceEarly] prevent the invocation of a\nfunction during **hot** periods (when there are too many calls), and can be used\nfor example to issue AJAX request after user input has stopped (for certain\ndelay time). [throttle] and [throttleEarly] can be used to limit the rate of\ninvocation of a function, and can be used for example to minimize system usage\nwhen a user is [constantly refreshing a webpage]. Except [restrict], all\n*rate/time control* methods can be *flushed* (`flush()`) to invoke the target\nfunction immediately, or *cleared* (`clear()`) to disable invocation of the\ntarget function.\n\nIn addition, [is], [name], and [length] obtain metadata (about) information on\nan async function. To attach a `this` to a function, use [bind]. A few generic\nasync functions are also included: [ARGUMENTS], [NOOP], [IDENTITY], [COMPARE].\n\nThis package is available in *Node.js* and *Web* formats. To use it on the web,\nsimply use the `extra_async_function` global variable after loading with a `\u003cscript\u003e`\ntag from the [jsDelivr CDN].\n\n[async function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function\n[result asynchronously]: https://exploringjs.com/impatient-js/ch_async-functions.html#async-constructs\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n[extra-function]: https://www.npmjs.com/package/extra-function\n[pipe-forward operator]: https://stackoverflow.com/questions/1457140/haskell-composition-vs-fs-pipe-forward-operator\n[function chaining]: https://www.npmjs.com/package/chain-function\n[Haskell]: https://www.haskell.org\n[haskell beginner guide]: http://learnyouahaskell.com\n[constantly refreshing a webpage]: https://tenor.com/view/social-network-mark-zuckerberg-refresh-movie-jesse-eisenberg-gif-12095762\n[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-async-function.web/index.js\n\n\u003e Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).\n\n\u003cbr\u003e\n\n\n```javascript\nconst xasyncfn = require('extra-async-function');\n// import * as xasyncfn from \"extra-async-function\";\n// import * as xasyncfn from \"https://unpkg.com/extra-async-function/index.mjs\"; (deno)\n\n// 1. Basic tests.\nasync function example1() {\n  var a = xasyncfn.composeRight(async x =\u003e x*x, async x =\u003e x+2);\n  await a(10);\n  // → 102\n\n  var a = xasyncfn.curry(async (x, y) =\u003e x+y);\n  await a(2)(3);\n  // → 7\n\n  var a = xasyncfn.unspread(async (...xs) =\u003e Math.max(...xs));\n  await a([2, 3, 1]);\n  // → 1.25\n}\nexample1();\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Property | Description |\n|  ----  |  ----  |\n| [ARGUMENTS] | Resolve all the arguments passed, as an array. |\n| [NOOP] | Do nothing. |\n| [IDENTITY] | Return the same (first) value. |\n| [COMPARE] | Compare two async values. |\n|  |  |\n| [name] | Get the name of a function. |\n| [length] | Get the number of parameters of a function. |\n|  |  |\n| [bind] | Bind this-object, and optional prefix arguments to a function. |\n|  |  |\n| [call] | Invoke a function with specified this-object, and arguments provided individually. |\n| [apply] | Invoke a function with specified this-object, and arguments provided as an array. |\n|  |  |\n| [is] | Check if value is an async function. |\n| [isGenerator] | Check if value is a generator function. |\n|  |  |\n| [contextify] | Contextify a function by accepting the first parameter as this-object. |\n| [decontextify] | Decontextify a function by accepting this-object as the first argument. |\n|  |  |\n| [negate] | Generate a result-negated version of an async function. |\n|  |  |\n| [memoize] | Generate result-cached version of an async function. |\n|  |  |\n| [reverse] | Generate a parameter-reversed version of a function. |\n| [spread] | Generate a (first) parameter-spreaded version of a function. |\n| [unspread] | Generate a (first) parameter-collapsed version of a function. |\n| [attach] | Attach prefix arguments to leftmost parameters of a function. |\n| [attachRight] | Attach suffix arguments to rightmost parameters of a function. |\n|  |  |\n| [compose] | Compose async functions together, in applicative order. |\n| [composeRight] | Compose async functions together, such that result is piped forward. |\n| [curry] | Generate curried version of a function. |\n| [curryRight] | Generate right-curried version of a function. |\n|  |  |\n| [defer] | Generate deferred version of a function, that executes after the current stack has cleared. |\n| [delay] | Generate delayed version of a function. |\n|  |  |\n| [restrict] | Generate restricted-use version of a function. |\n| [restrictOnce] | Restrict a function to be used only once. |\n| [restrictBefore] | Restrict a function to be used only upto a certain number of calls. |\n| [restrictAfter] | Restrict a function to be used only after a certain number of calls. |\n|  |  |\n| [debounce] | Generate debounced version of a function. |\n| [debounceEarly] | Generate leading-edge debounced version of a function. |\n| [throttle] | Generate throttled version of a function. |\n| [throttleEarly] | Generate leading-edge throttled version of a function. |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [MDN Web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference)\n- [Lodash documentation](https://lodash.com/docs/4.17.15)\n- [Underscore.js documentation](https://underscorejs.org/)\n- [Function composition](https://en.wikipedia.org/wiki/Function_composition)\n- [Debouncing and Throttling Explained Through Examples by David Corbacho](https://css-tricks.com/debouncing-throttling-explained-examples/)\n- [Learn You a Haskell for Great Good!: Higher order functions by Miran Lipovaca](http://learnyouahaskell.com/higher-order-functions)\n- [Haskell composition (.) vs F#'s pipe forward operator (|\u003e)](https://stackoverflow.com/questions/1457140/haskell-composition-vs-fs-pipe-forward-operator)\n- [memoizee package by Mariusz Nowak](https://www.npmjs.com/package/memoizee)\n- [memoizerific package by @thinkloop](https://www.npmjs.com/package/memoizerific)\n- [compose-function package by Christoph Hermann](https://www.npmjs.com/package/compose-function)\n- [chain-function package by Jason Quense](https://www.npmjs.com/package/chain-function)\n- [extra-function package by Subhajit Sahu](https://www.npmjs.com/package/extra-function)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://img.youtube.com/vi/pIQwho5EU8w/maxresdefault.jpg)](https://www.youtube.com/watch?v=pIQwho5EU8w)\u003cbr\u003e\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n[![DOI](https://zenodo.org/badge/277720718.svg)](https://zenodo.org/badge/latestdoi/277720718)\n[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-async-function/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-async-function?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/8e1e922c3b1ea166857b/test_coverage)](https://codeclimate.com/github/nodef/extra-async-function/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/8e1e922c3b1ea166857b/maintainability)](https://codeclimate.com/github/nodef/extra-async-function/maintainability)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-async-function)\n\n[ARGUMENTS]: https://github.com/nodef/extra-async-function/wiki/ARGUMENTS\n[NOOP]: https://github.com/nodef/extra-async-function/wiki/NOOP\n[IDENTITY]: https://github.com/nodef/extra-async-function/wiki/IDENTITY\n[COMPARE]: https://github.com/nodef/extra-async-function/wiki/COMPARE\n[is]: https://github.com/nodef/extra-async-function/wiki/is\n[name]: https://github.com/nodef/extra-async-function/wiki/name\n[bind]: https://github.com/nodef/extra-async-function/wiki/bind\n[negate]: https://github.com/nodef/extra-async-function/wiki/negate\n[memoize]: https://github.com/nodef/extra-async-function/wiki/memoize\n[reverse]: https://github.com/nodef/extra-async-function/wiki/reverse\n[spread]: https://github.com/nodef/extra-async-function/wiki/spread\n[unspread]: https://github.com/nodef/extra-async-function/wiki/unspread\n[compose]: https://github.com/nodef/extra-async-function/wiki/compose\n[composeRight]: https://github.com/nodef/extra-async-function/wiki/composeRight\n[curry]: https://github.com/nodef/extra-async-function/wiki/curry\n[curryRight]: https://github.com/nodef/extra-async-function/wiki/curryRight\n[delay]: https://github.com/nodef/extra-async-function/wiki/delay\n[debounce]: https://github.com/nodef/extra-async-function/wiki/debounce\n[debounceEarly]: https://github.com/nodef/extra-async-function/wiki/debounceEarly\n[throttle]: https://github.com/nodef/extra-async-function/wiki/throttle\n[throttleEarly]: https://github.com/nodef/extra-async-function/wiki/throttleEarly\n[length]: https://github.com/nodef/extra-async-function/wiki/length\n[call]: https://github.com/nodef/extra-async-function/wiki/call\n[apply]: https://github.com/nodef/extra-async-function/wiki/apply\n[isGenerator]: https://github.com/nodef/extra-async-function/wiki/isGenerator\n[contextify]: https://github.com/nodef/extra-async-function/wiki/contextify\n[decontextify]: https://github.com/nodef/extra-async-function/wiki/decontextify\n[attach]: https://github.com/nodef/extra-async-function/wiki/attach\n[attachRight]: https://github.com/nodef/extra-async-function/wiki/attachRight\n[defer]: https://github.com/nodef/extra-async-function/wiki/defer\n[restrict]: https://github.com/nodef/extra-async-function/wiki/restrict\n[restrictOnce]: https://github.com/nodef/extra-async-function/wiki/restrictOnce\n[restrictBefore]: https://github.com/nodef/extra-async-function/wiki/restrictBefore\n[restrictAfter]: https://github.com/nodef/extra-async-function/wiki/restrictAfter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-async-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-async-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-async-function/lists"}