From 665b3502704ab331a5d749708b652daa33fb7d64 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Mon, 26 Sep 2022 13:47:20 -0700 Subject: [PATCH] fixes #173: add section to README about accessing new intrinsics (#235) --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 02a8f16..049b634 100644 --- a/README.md +++ b/README.md @@ -420,6 +420,15 @@ only consume the iterator when they need the next item from it. Especially for iterators that never end, this is key. Without generic support for any form of iterator, different iterators have to be handled differently. +### How can I access the new intrinsics? + +```js +const IteratorHelperPrototype = Object.getPrototypeOf(Iterator.from([]).take(0)); +const AsyncIteratorHelperPrototype = Object.getPrototypeOf(AsyncIterator.from([]).take(0)); +const WrapForValidIteratorPrototype = Object.getPrototypeOf(Iterator.from({ next(){} })); +const WrapForValidAsyncIteratorPrototype = Object.getPrototypeOf(AsyncIterator.from({ async next(){} })); +``` + ## Prior Art & Userland implementations - https://www.npmjs.com/package/itertools