Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Deprecate generator transforms?

未关闭
#32 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

Start with the Generators.filter and Generators.map entries linked from the README, then inspect their iterator and promise behavior against the three concerns described. Done requires a maintainer decision on deprecation versus redesign and a clearly scoped follow-up, since the issue does not select an implementation path.

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

描述

question

We currently provide two utility methods for creating a new Generator from an iterator: Generators.filter and Generators.map. There are a few problems with these methods:

  1. If the input iterator is a Generator, the returned Generator does not wrap generator.return and generator.throw. Possibly, these methods should return an Iterator rather than a Generator, and be moved to Iterators.filter and Iterators.map. Or, these methods could “upgrade” an iterator to a generator, and wrap the return and throw methods as expected.

  2. If the input iterator iterates over promises, the generator doesn’t wait for the promise to resolve. Coming from Observable, we somewhat expect the test or transform functions to be passed resolved values rather than Promise objects. However, in the case of Generators.filter, it’s not clear how that should work, since the test function might return false for the last promise, but it’s too late because the generator has already yielded a promise!

  3. If the input iterator is an async iterator (i.e., iterator.next returns a Promise), these methods don’t work at all.

It’s possible that the simplest thing to do would be to deprecate these methods along with the deprecated DOM methods #31. I haven’t found them especially useful, and given the desire to keep the standard library small, it might be good to prune them.

主要语言
JavaScript
星标
1k
派生
87
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

observablehq/stdlib 的其他 Issue

查看 observablehq/stdlib 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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