diff --git a/CHANGELOG.md b/CHANGELOG.md index e14626f..79a8b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.12.13] - Unreleased +### Fixed +- Improved the code of iterator with an array. + ## [1.12.12] - 2024-11-19 ### Added - New option `autoDataVarname` to replace `useWith`. @@ -271,6 +275,7 @@ First version [#74]: https://github.com/oscarotero/vento/issues/74 [#83]: https://github.com/oscarotero/vento/issues/83 +[1.12.13]: https://github.com/oscarotero/vento/compare/v1.12.12...HEAD [1.12.12]: https://github.com/oscarotero/vento/compare/v1.12.11...v1.12.12 [1.12.11]: https://github.com/oscarotero/vento/compare/v1.12.10...v1.12.11 [1.12.10]: https://github.com/oscarotero/vento/compare/v0.12.9...v1.12.10 diff --git a/plugins/for.ts b/plugins/for.ts index 3b85d0b..794733f 100644 --- a/plugins/for.ts +++ b/plugins/for.ts @@ -59,9 +59,7 @@ function toIterator( } if (Array.isArray(item)) { - return withKeys - ? Object.entries(item).map(([key, value]) => [parseInt(key, 10), value]) - : item; + return withKeys ? item.map((value, i) => [i, value]) : item; } if (typeof item === "function") {