mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.13k stars 22.45k forks source link

[JS] Ship (synchronous) Iterator Helpers #35698

Open Rumyra opened 2 weeks ago

Rumyra commented 2 weeks ago

Acceptance criteria

For folks helping with Firefox related documentation

Related Gecko bugs

https://bugzilla.mozilla.org/show_bug.cgi?id=1896390

Other

hamishwillee commented 3 days ago

Status

Josh-Cena commented 3 days ago

iterator helper section on Iterator page - e.g. reduce() is described on that page but not linked from it (while drop() does link.

Sorry, not sure what you mean? You mean that the drop() page has a link to "Iterator helper"? This is because of the following:

Among these methods, filter(), flatMap(), map(), drop(), and take() return a new Iterator Helper object. The iterator helper is also an Iterator instance, making the helper methods chainable

Only these methods return an "Iterator helper" object. Other methods can be called "Iterator helper" methods, but the term "Iterator helper" itself is not necessary to explain their behavior.

hamishwillee commented 3 days ago

@Josh-Cena Yes, that is what I meant. If you look at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers it reads as a topic on "Iterator helpers" not "the iterator helper object". It uses reduce() as the example of what iterator helpers are for.

So my argument here was that this would be a useful link from reduce() and the other iterator helper methods, whether or not they return Iterator helper objects.

I quite like the idea of this topic on the helper rather than helper-object focus because it allows me to understand why they are useful.

Josh-Cena commented 1 day ago

Well I have no opinions about doing that. If you want to mention "iterator helper method" in the description, sure.

hamishwillee commented 1 day ago

Thanks. I think it would be as a See also link from all the methods. But if you're unconvinced, I'm not pushing it.

Josh-Cena commented 1 day ago

Sounds good to me :+1: