From f160c78eaa3d1852eec8d8dcfaeaa205456e7df8 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 9 Aug 2022 11:25:10 +0300 Subject: [PATCH] docs and notes... Signed-off-by: Alex A. Naanou --- README.md | 4 ++-- generator.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 79f3413..f5d1c73 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Library of JavaScript type extensions, types and utilities. - [`.iter(..)`](#generatoriter-1) - [`.map(..)` / `.filter(..)`](#generatormap--generatorfilter) - [`.reduce(..)` / `.greduce(..)`](#generatorreduce--generatorgreduce) - - [`.forEach(..)`](#generatorforeach) + - [`.forEach(..) (EXPERIMENTAL)`](#generatorforeach-experimental) - [`.slice(..)`](#generatorslice) - [`.at(..)` / `.gat(..)`](#generatorat--generatorgat) - [`.flat(..)`](#generatorflat) @@ -2136,7 +2136,7 @@ XXX .reduce(..) can return a non-iterable -- test and document this case... ...compare with Array.prototype.reduce(..) --> -#### `.forEach(..)` +#### `.forEach(..)` (EXPERIMENTAL) ```bnf .forEach() diff --git a/generator.js b/generator.js index d9593ca..b0bd810 100644 --- a/generator.js +++ b/generator.js @@ -223,7 +223,8 @@ object.Mixin('GeneratorMixin', 'soft', { reduce: makeGenerator('reduce'), reduceRight: makeGenerator('reduceRight'), - // XXX add .toString(..) ??? + // XXX EXPERIMENTAL + // XXX add .toString(..) to this??? forEach: function(func){ var that = this return function(){ @@ -406,6 +407,7 @@ object.Mixin('GeneratorProtoMixin', 'soft', { // NOTE: this is a special case in that it will unwind the generator... // NOTE: this is different from .forEach(..) in that this will // return the resulting array. + // XXX EXPERIMENTAL forEach: function(func){ return [...this].map(func) },