stdlib-js / stdlib-js/stdlib

[RFC]: Refactor mapFunAsync to Include Status Tracking

未关闭
#5,800 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
6k
派生
1.3k
平均合并
1 天 3 小时
30 天内合并 PR
611

描述

### Description

This RFC proposes refactoring the mapFunAsync function in @stdlib/utils-async-map-function to return an object that allows querying the status of in-flight asynchronous operations. This aligns with the goal of achieving feature parity with async.js while improving observability of async execution states.

### Related Issues

Related issues #9 which states that we need to achive parity with async.js.
Changes:

Modified mapFunAsync to return an object containing:

status: Tracks the state (pending, completed, or error).

getStatus(): Method to retrieve the current state.

cancel(): Method to cancel execution (if applicable in the future).

Updated tests to validate the new behavior.

Updated documentation to reflect the API changes.

Motivation:
This refactor improves the usability of mapFunAsync by enabling users to track ongoing async operations, which is particularly useful in long-running tasks or when debugging async workflows.
@kgryte @Planeshifter @steff456

### Questions

No.

### Other

No.

### Checklist

- [x] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.
- [x] The issue name begins with `RFC:`.

贡献指南

打开贡献指南

调研方向

Start at the mapFunAsync implementation in @stdlib/utils-async-map-function and review its existing tests and documentation. Compare the proposed status, getStatus(), and cancel() API with the async.js parity goal and related issue #9. Done means the refactored API, tests, and documentation consistently describe and validate status tracking.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
backend
Issue 类型
重构
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。