common
common copied to clipboard
Implement Iterator#keepLast() to allow storing last iterator value
- [x] code is properly formatted (
npm run fmt
) - [x] tests are added/updated
- [x] documentation is updated (
npm run doc
to regenerate documentation based on comments) - [x] description of changes is added under the
Unreleased
header in CHANGELOG.md
I think the proposed splitOn
is something like https://github.com/metarhia/common/pull/339.
Will think about a better solution.
Leading to a situation where you have multiple iterators sharing a common state.
Though, what's wrong with this? I think it's already possible if someone wants to take values from the same iterator in multiple places (which is fine IMO) or misuses iterator (like using async
function in .map
etc).
Though, what's wrong with this? I think it's already possible if someone wants to take values from the same iterator in multiple places (which is fine IMO) or misuses iterator (like using async function in .map etc).
The problem is that it forces programmers to save iterator pre-transformation. I know that it is currently possible to misuse iterators, but I believe that we should not encourage such patterns.