extra-async-function

An async function is a function that delivers its result asynchronously (through Promise).

https://github.com/nodef/extra-async-function

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.2%) to scientific vocabulary

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
Last synced: 6 months ago · JSON representation ·

Repository

An async function is a function that delivers its result asynchronously (through Promise).

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
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
Created over 5 years ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

An async function is a function that delivers its result asynchronously.
📦 Node.js, 🌐 Web, 📜 Files, 📰 JSDoc, 📘 Wiki.

This package is an variant of extra-function, and includes methods for transforming async functions. The result of an async function can be manipulated with negate. If a pure async function is expensive, its results can cached with memoize. Parameters of a function can be manipulated with reverse, spread, unspread. reverse flips the order of parameters, spread spreads the first array parameter of a function, and unspread combines all parameters into the first parameter (array). If you want some functional behavior, compose, composeRight, curry, and curryRight can be used. composeRight is also known as pipe-forward operator or function chaining. If you are unfamiliar, Haskell is a great purely functional language, and there is great haskell beginner guide to learn from.

To control invocation time of a function, use delay. A function can be rate controlled with debounce, debounceEarly, throttle, throttleEarly. debounce and debounceEarly prevent the invocation of a function during hot periods (when there are too many calls), and can be used for example to issue AJAX request after user input has stopped (for certain delay time). throttle and throttleEarly can be used to limit the rate of invocation of a function, and can be used for example to minimize system usage when a user is constantly refreshing a webpage. Except restrict, all rate/time control methods can be flushed (flush()) to invoke the target function immediately, or cleared (clear()) to disable invocation of the target function.

In addition, is, name, and length obtain metadata (about) information on an async function. To attach a this to a function, use bind. A few generic async functions are also included: ARGUMENTS, NOOP, IDENTITY, COMPARE.

This package is available in Node.js and Web formats. To use it on the web, simply use the extra_async_function global variable after loading with a <script> tag from the jsDelivr CDN.

Stability: Experimental.


```javascript const xasyncfn = require('extra-async-function'); // import * as xasyncfn from "extra-async-function"; // import * as xasyncfn from "https://unpkg.com/extra-async-function/index.mjs"; (deno)

// 1. Basic tests. async function example1() { var a = xasyncfn.composeRight(async x => x*x, async x => x+2); await a(10); // → 102

var a = xasyncfn.curry(async (x, y) => x+y); await a(2)(3); // → 7

var a = xasyncfn.unspread(async (...xs) => Math.max(...xs)); await a([2, 3, 1]); // → 1.25 } example1(); ```



Index

| Property | Description | | ---- | ---- | | ARGUMENTS | Resolve all the arguments passed, as an array. | | NOOP | Do nothing. | | IDENTITY | Return the same (first) value. | | COMPARE | Compare two async values. | | | | | name | Get the name of a function. | | length | Get the number of parameters of a function. | | | | | bind | Bind this-object, and optional prefix arguments to a function. | | | | | call | Invoke a function with specified this-object, and arguments provided individually. | | apply | Invoke a function with specified this-object, and arguments provided as an array. | | | | | is | Check if value is an async function. | | isGenerator | Check if value is a generator function. | | | | | contextify | Contextify a function by accepting the first parameter as this-object. | | decontextify | Decontextify a function by accepting this-object as the first argument. | | | | | negate | Generate a result-negated version of an async function. | | | | | memoize | Generate result-cached version of an async function. | | | | | reverse | Generate a parameter-reversed version of a function. | | spread | Generate a (first) parameter-spreaded version of a function. | | unspread | Generate a (first) parameter-collapsed version of a function. | | attach | Attach prefix arguments to leftmost parameters of a function. | | attachRight | Attach suffix arguments to rightmost parameters of a function. | | | | | compose | Compose async functions together, in applicative order. | | composeRight | Compose async functions together, such that result is piped forward. | | curry | Generate curried version of a function. | | curryRight | Generate right-curried version of a function. | | | | | defer | Generate deferred version of a function, that executes after the current stack has cleared. | | delay | Generate delayed version of a function. | | | | | restrict | Generate restricted-use version of a function. | | restrictOnce | Restrict a function to be used only once. | | restrictBefore | Restrict a function to be used only upto a certain number of calls. | | restrictAfter | Restrict a function to be used only after a certain number of calls. | | | | | debounce | Generate debounced version of a function. | | debounceEarly | Generate leading-edge debounced version of a function. | | throttle | Generate throttled version of a function. | | throttleEarly | Generate leading-edge throttled version of a function. |



References




ORG DOI Coverage Status Test Coverage Maintainability

Owner

  • Name: nodef
  • Login: nodef
  • Kind: organization

A summary of programs made with Node.js.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Sahu
    given-names: Subhajit
    orcid: https://orcid.org/0000-0001-5140-6578
title: "nodef/extra-async-function: A collection of ways for transforming async functions"
version: 1.0.0
doi: 10.5281/zenodo.6814067
date-released: 2022-07-09

GitHub Events

Total
  • Push event: 2
Last Year
  • Push event: 2

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 42
  • Total Committers: 1
  • Avg Commits per committer: 42.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Subhajit Sahu w****7@g****m 42

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.29
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 14
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (7)
Top Labels
Issue Labels
Pull Request Labels
dependencies (7)

Packages

  • Total packages: 2
  • Total downloads:
    • npm 90 last-month
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 73
  • Total maintainers: 1
npmjs.org: extra-async-function

An async function is a function that delivers its result asynchronously (through Promise).

  • Versions: 37
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 56 Last month
Rankings
Downloads: 16.0%
Dependent packages count: 16.2%
Forks count: 20.5%
Average: 21.0%
Dependent repos count: 25.3%
Stargazers count: 27.1%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: extra-async-function.web

An async function is a function that delivers its result asynchronously (through Promise) {web}.

  • Versions: 36
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 34 Last month
Rankings
Dependent packages count: 16.2%
Downloads: 16.3%
Forks count: 20.5%
Average: 21.1%
Dependent repos count: 25.3%
Stargazers count: 27.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

package-lock.json npm
  • @babel/code-frame 7.18.6 development
  • @babel/helper-validator-identifier 7.18.6 development
  • @babel/highlight 7.18.6 development
  • @octokit/auth-token 3.0.0 development
  • @octokit/auth-token 2.5.0 development
  • @octokit/core 4.0.4 development
  • @octokit/core 3.6.0 development
  • @octokit/endpoint 7.0.0 development
  • @octokit/endpoint 6.0.12 development
  • @octokit/graphql 5.0.0 development
  • @octokit/graphql 4.8.0 development
  • @octokit/openapi-types 12.8.0 development
  • @octokit/plugin-paginate-rest 2.21.2 development
  • @octokit/plugin-request-log 1.0.4 development
  • @octokit/plugin-rest-endpoint-methods 5.16.2 development
  • @octokit/request 6.0.2 development
  • @octokit/request 5.6.3 development
  • @octokit/request-error 3.0.0 development
  • @octokit/request-error 2.1.0 development
  • @octokit/rest 18.12.0 development
  • @octokit/types 6.39.0 development
  • @rollup/plugin-commonjs 22.0.1 development
  • @rollup/plugin-node-resolve 13.3.0 development
  • @rollup/pluginutils 3.1.0 development
  • @types/estree 0.0.39 development
  • @types/node 14.10.1 development
  • @types/resolve 1.17.1 development
  • ansi-styles 3.2.1 development
  • balanced-match 1.0.0 development
  • before-after-hook 2.2.2 development
  • brace-expansion 2.0.1 development
  • brace-expansion 1.1.11 development
  • builtin-modules 3.3.0 development
  • chalk 2.4.2 development
  • color-convert 1.9.3 development
  • color-name 1.1.3 development
  • commondir 1.0.1 development
  • concat-map 0.0.1 development
  • deepmerge 4.2.2 development
  • deprecation 2.3.1 development
  • escape-string-regexp 1.0.5 development
  • estree-walker 1.0.1 development
  • estree-walker 0.6.1 development
  • estree-walker 2.0.1 development
  • extra-build 2.1.31 development
  • extra-function 1.0.5 development
  • extra-markdown-text 0.1.0 development
  • fs.realpath 1.0.0 development
  • fsevents 2.3.2 development
  • function-bind 1.1.1 development
  • glob 7.1.6 development
  • glob 8.0.3 development
  • has 1.0.3 development
  • has-flag 3.0.0 development
  • inflight 1.0.6 development
  • inherits 2.0.4 development
  • is-builtin-module 3.1.0 development
  • is-core-module 2.9.0 development
  • is-module 1.0.0 development
  • is-plain-object 5.0.0 development
  • is-reference 1.2.1 development
  • js-cleanup 1.2.0 development
  • js-tokens 4.0.0 development
  • jsonc-parser 3.0.0 development
  • kleur 4.1.5 development
  • lru-cache 6.0.0 development
  • lunr 2.3.9 development
  • magic-string 0.25.7 development
  • magic-string 0.26.2 development
  • marked 4.0.17 development
  • minimatch 3.0.4 development
  • minimatch 5.1.0 development
  • node-fetch 2.6.7 development
  • once 1.4.0 development
  • path-is-absolute 1.0.1 development
  • path-parse 1.0.7 development
  • perf-regexes 1.0.1 development
  • picomatch 2.2.2 development
  • resolve 1.22.1 development
  • rollup 2.76.0 development
  • rollup-plugin-cleanup 3.2.1 development
  • rollup-plugin-dts 4.2.2 development
  • rollup-pluginutils 2.8.2 development
  • semver 7.3.7 development
  • shiki 0.10.1 development
  • skip-regex 1.0.2 development
  • sourcemap-codec 1.4.8 development
  • supports-color 5.5.0 development
  • supports-preserve-symlinks-flag 1.0.0 development
  • tr46 0.0.3 development
  • typedoc 0.22.18 development
  • typescript 4.7.4 development
  • universal-user-agent 6.0.0 development
  • vscode-oniguruma 1.6.2 development
  • vscode-textmate 5.2.0 development
  • webidl-conversions 3.0.1 development
  • whatwg-url 5.0.0 development
  • wrappy 1.0.2 development
  • yallist 4.0.0 development
package.json npm
  • @rollup/plugin-commonjs ^22.0.1 development
  • @rollup/plugin-node-resolve ^13.3.0 development
  • extra-build ^2.1.31 development
  • extra-function ^1.0.5 development
  • rollup-plugin-cleanup ^3.2.1 development
  • rollup-plugin-dts ^4.2.2 development
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v2 composite
  • coverallsapp/github-action master composite
  • paambaati/codeclimate-action v3.0.0 composite
.github/workflows/pr.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v2 composite