{"id":16911095,"url":"https://github.com/zloirock/forof","last_synced_at":"2025-04-11T15:52:21.209Z","repository":{"id":33756064,"uuid":"37411351","full_name":"zloirock/forof","owner":"zloirock","description":"Work with iterators from ES5 / ES3 syntax.","archived":false,"fork":false,"pushed_at":"2019-10-30T01:22:58.000Z","size":10,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T09:52:39.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Yalantis/Koloda","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zloirock.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}},"created_at":"2015-06-14T12:25:08.000Z","updated_at":"2025-02-01T16:31:07.000Z","dependencies_parsed_at":"2022-09-20T21:04:39.095Z","dependency_job_id":null,"html_url":"https://github.com/zloirock/forof","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zloirock%2Fforof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zloirock%2Fforof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zloirock%2Fforof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zloirock%2Fforof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zloirock","download_url":"https://codeload.github.com/zloirock/forof/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248435354,"owners_count":21103013,"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":[],"created_at":"2024-10-13T19:04:25.977Z","updated_at":"2025-04-11T15:52:21.187Z","avatar_url":"https://github.com/zloirock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forof\nWork with iterators from ES5 / ES3 syntax. Equals of `for-of` loop and array / generator comprehensions. Extracted from [core-js](https://github.com/zloirock/core-js). Does not contains polyfills of collections and standard iterators, if you need it - use `core-js`.\n\n**Deprecated in favor of usage iterator helpers proposal [implemented in `core-js`](https://github.com/zloirock/core-js#iterator-helpers).**\n\n[development version](https://raw.githack.com/zloirock/forof/master/index.js), [production version](https://raw.githack.com/zloirock/forof/master/forof.min.js)\n\n[![NPM](https://nodei.co/npm/forof.png?downloads=true)](https://www.npmjs.org/package/forof/) [![Build Status](https://travis-ci.org/zloirock/forof.png)](https://travis-ci.org/zloirock/forof)\n\n```javascript\n$for(iterable, entries) -\u003e iterator ($for)\n  #of(fn(value, key?), that) -\u003e void\n  #array(mapFn(value, key?)?, that) -\u003e array\n  #filter(fn(value, key?), that) -\u003e iterator ($for)\n  #map(fn(value, key?), that) -\u003e iterator ($for)\n```\n[Examples](http://goo.gl/Jtz0oG):\n```javascript\nvar $for = require('forof'); // with a modular system, otherwise use global `$for`\n\n$for(new Set([1, 2, 3, 2, 1])).of(function(it){\n  log(it); // =\u003e 1, 2, 3\n});\n\n$for([1, 2, 3].entries(), true).of(function(key, value){\n  log(key);   // =\u003e 0, 1, 2\n  log(value); // =\u003e 1, 2, 3\n});\n\n$for('abc').of(console.log, console); // =\u003e 'a', 'b', 'c'\n\n$for([1, 2, 3, 4, 5]).of(function(it){\n  log(it); // =\u003e 1, 2, 3\n  if(it == 3)return false;\n});\n\nvar ar1 = $for([1, 2, 3]).array(function(v){\n  return v * v;\n}); // =\u003e [1, 4, 9]\n\nvar set = new Set([1, 2, 3, 2, 1]);\nvar ar1 = $for(set).filter(function(v){\n  return v % 2;\n}).array(function(v){\n  return v * v;\n}); // =\u003e [1, 9]\n\nvar iter = $for(set).filter(function(v){\n  return v % 2;\n}).map(function(v){\n  return v * v;\n});\niter.next(); // =\u003e {value: 1, done: false}\niter.next(); // =\u003e {value: 9, done: false}\niter.next(); // =\u003e {value: undefined, done: true}\n\nvar map1 = new Map([['a', 1], ['b', 2], ['c', 3]]);\nvar map2 = new Map($for(map1, true).filter(function(k, v){\n  return v % 2;\n}).map(function(k, v){\n  return [k + k, v * v];\n})); // =\u003e Map {aa: 1, cc: 9}\n```\n## Changelog\n##### 1.0.0 - 2015.06.14\n  * publish","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzloirock%2Fforof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzloirock%2Fforof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzloirock%2Fforof/lists"}