{"id":23503516,"url":"https://github.com/realyuniquename/iterators","last_synced_at":"2026-02-16T19:36:00.452Z","repository":{"id":151066931,"uuid":"119859956","full_name":"RealyUniqueName/Iterators","owner":"RealyUniqueName","description":"A collection of useful iterators for Haxe","archived":false,"fork":false,"pushed_at":"2019-01-31T08:03:50.000Z","size":18,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T17:56:15.127Z","etag":null,"topics":["haxe","iterator"],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RealyUniqueName.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-01T16:11:17.000Z","updated_at":"2024-11-05T00:05:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad7860e4-59a1-4b6e-bfb2-b9f9ce75ae3c","html_url":"https://github.com/RealyUniqueName/Iterators","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FIterators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FIterators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FIterators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealyUniqueName%2FIterators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealyUniqueName","download_url":"https://codeload.github.com/RealyUniqueName/Iterators/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252531918,"owners_count":21763304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haxe","iterator"],"created_at":"2024-12-25T08:30:02.243Z","updated_at":"2025-09-17T21:05:12.585Z","avatar_url":"https://github.com/RealyUniqueName.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iterators [![Build Status](https://travis-ci.org/RealyUniqueName/Iterators.svg?branch=master)](https://travis-ci.org/RealyUniqueName/Iterators)\n\nThis is a set of frequently used iterators for Haxe collections and other types.\n\nAll iterators are designed to have zero impact on runtime performance.\n\nCompatible with Haxe 3.4 and 4.0\n\n# Installation\n\n```\nhaxelib install iterators\n```\n\n# Usage\n\n```haxe\nusing Iterators;\n\nfor(i in 10.to(0).step(-2)) { //.step() is optional\n\ttrace(i);\n}\n\nvar str = 'hello';\nfor(c in str.chars()) {\n\ttrace(c);\n}\n```\n\nFull list of available iterators:\n\n```haxe\nclass MapIterators {\n\t/**\n\t *  Map iterator which allows you to get key \u0026 value in one go.\n\t *  ```\n\t *  var m = [1 =\u003e 'hello'];\n\t *  for(p in map.pairs()) {\n\t *  \ttrace(p.key); // 1\n\t *  \ttrace(p.value); // hello\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function pairs\u003cK,V\u003e(map:Map\u003cK,V\u003e) return new MapPairIterator(map);\n}\nclass DynamicAccessIterators {\n\t/**\n\t *  Iterator for `haxe.DynamicAccess` which allows you to get key \u0026 value in one go.\n\t *  ```\n\t *  var obj:DynamicAccess\u003cString\u003e = {hello:'world'};\n\t *  for(p in obj.pairs()) {\n\t *  \ttrace(p.key); // hello\n\t *  \ttrace(p.value); // world\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function pairs\u003cV\u003e(obj:DynamicAccess\u003cV\u003e) return new KeyValueDynamicAccessIterator(obj);\n}\nclass ArrayIterators {\n\t/**\n\t *  Array iterator which allows you to get index \u0026 value in one go.\n\t *  ```\n\t *  var a = ['hello'];\n\t *  for(p in a.pairs()) {\n\t *  \ttrace(p.index); // 0\n\t *  \ttrace(p.value); // 'hello'\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function pairs\u003cV\u003e(array:Array\u003cV\u003e) return new IndexValueIterator(array);\n\t/**\n\t *  Array iterator which iterates from the end to the beginning of an array and allows you to get index \u0026 value in one go.\n\t */\n\tstatic public inline function reversePairs\u003cV\u003e(array:Array\u003cV\u003e) return new IndexValueReversiveIterator(array);\n\t/**\n\t *  Array iterator which iterates from the end to the beginning of an array.\n\t */\n\tstatic public inline function reverseValues\u003cV\u003e(array:Array\u003cV\u003e) return new ValueReversiveIterator(array);\n}\nclass StringIterators {\n\t/**\n\t *  String iterator which allows you to get index \u0026 character in one go.\n\t *  ```\n\t *  var str = 'hello';\n\t *  for(p in str.pairs()) {\n\t *  \ttrace(p.index);\n\t *  \ttrace(p.char);\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function pairs(str:String) return new IndexCharIterator(str);\n\t/**\n\t *  String iterator which iterates from the end to the beginning of a string and allows you to get index \u0026 character in one go.\n\t */\n\tstatic public inline function reversePairs(str:String) return new IndexCharReversiveIterator(str);\n\t/**\n\t *  String iterator over characters.\n\t *  ```\n\t *  var str = 'hello';\n\t *  for(c in str.chars()) {\n\t *  \ttrace(c); // Sequentially prints: h, e, l, l, o\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function chars(str:String) return new CharIterator(str);\n\t/**\n\t *  String iterator over characters from the end to the beginnning of a string.\n\t */\n\tstatic public inline function reverseChars(str:String) return new CharReversiveIterator(str);\n\t/**\n\t *  String iterator over codes of characters.\n\t *  ```\n\t *  var str = 'hi';\n\t *  for(c in str.charCodes()) {\n\t *  \ttrace(c); // Sequentially prints: 104, 105\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function charCodes(str:String) return new CharCodeIterator(str);\n\t/**\n\t *  String iterator over codes of characters from the end to the beginnning of a string.\n\t *  ```\n\t *  var str = 'hi';\n\t *  for(c in str.charCodes()) {\n\t *  \ttrace(c); // Sequentially prints: 105, 104\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function reverseCharCodes(str:String) return new CharCodeReversiveIterator(str);\n}\nclass LengthIterators {\n\t/**\n\t *  Iterator for values with `length` field which iterates over indices from the end to the beginning of a `value`.\n\t */\n\t@:generic\n\tstatic public inline function reverseIndices\u003cT:{var length(default,never):Int;}\u003e(value:T) return new IndexReversiveIterator(value.length);\n}\nclass IntIterators {\n\t/**\n\t *  Int iterator from `from` (including) to `to` (excluding).\n\t *  ```\n\t *  var value = 10;\n\t *  for(i in value.to(13)) {\n\t *  \ttrace(i); // Sequentially prints: 10, 11, 12\n\t *  }\n\t *  for(i in value.to(7)) {\n\t *  \ttrace(i); // Sequentially prints: 10, 9, 8\n\t *  }\n\t *  for(i in value.to(15).step(2)) {\n\t *  \ttrace(i); // Sequentially prints: 10, 12, 14\n\t *  }\n\t *  ```\n\t */\n\tstatic inline public function to(from:Int, to:Float) return new IntIterator(from, to);\n}\nclass FloatIterators {\n\t/**\n\t *  Float iterator from `from` (including) to `to` (excluding).\n\t *  ```\n\t *  var value = 10.5;\n\t *  for(i in value.floatTo(13)) {\n\t *  \ttrace(i); // Sequentially prints: 10.5, 11.5, 12.5\n\t *  }\n\t *  for(i in value.floatTo(7)) {\n\t *  \ttrace(i); // Sequentially prints: 10.5, 9.5, 8.5\n\t *  }\n\t *  for(i in value.floatTo(12).step(0.5)) {\n\t *  \ttrace(i); // Sequentially prints: 10.5, 11, 11.5\n\t *  }\n\t *  ```\n\t */\n\tstatic inline public function floatTo(from:Float, to:Float) return new FloatIterator(from, to);\n}\nclass AnonymousObjectIterators {\n\t/**\n\t *  Object iterator which allows you to get field name \u0026 value in one go.\n\t *  It is only guaranteed to work with anonymous objects.\n\t *\n\t *  @throws iterators.exceptions.IllegalValueException - if `object` is not an object.\n\t *\n\t *  ```\n\t *  var obj:Any = Json.parse(data);\n\t *  for(f in obj.fields()) {\n\t *  \ttrace(f.name);\n\t *  \ttrace(f.value);\n\t *  }\n\t *  ```\n\t */\n\tstatic public inline function fields(object:Dynamic) return new FieldValueIterator(object);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fiterators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealyuniquename%2Fiterators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealyuniquename%2Fiterators/lists"}