{"id":16095738,"url":"https://github.com/zeusdeux/lazit","last_synced_at":"2025-06-27T11:40:27.713Z","repository":{"id":27486220,"uuid":"30966200","full_name":"zeusdeux/lazit","owner":"zeusdeux","description":"Lazy composable operations on iterators/generators.","archived":false,"fork":false,"pushed_at":"2015-04-30T01:20:38.000Z","size":552,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-17T12:38:43.819Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/lazit","language":"JavaScript","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/zeusdeux.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-02-18T13:17:42.000Z","updated_at":"2019-08-13T16:03:23.000Z","dependencies_parsed_at":"2022-09-02T09:00:31.853Z","dependency_job_id":null,"html_url":"https://github.com/zeusdeux/lazit","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/zeusdeux/lazit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeusdeux%2Flazit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeusdeux%2Flazit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeusdeux%2Flazit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeusdeux%2Flazit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeusdeux","download_url":"https://codeload.github.com/zeusdeux/lazit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeusdeux%2Flazit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260406248,"owners_count":23004121,"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-09T17:08:26.801Z","updated_at":"2025-06-27T11:40:27.676Z","avatar_url":"https://github.com/zeusdeux.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lazit\n\n[![Build Status](https://travis-ci.org/zeusdeux/lazit.svg)](https://travis-ci.org/zeusdeux/lazit)\n\nLazy, composable operations on iterators/generators for ES6 and beyond.\n\n\u003e Use lazit right now with transpilers like [babeljs](http://babeljs.io) or the [Google Traceur Compiler](https://github.com/google/traceur-compiler)\n\u003e or by using `build/lazit.js` or `build/lazit.min.js` which are precompiled using babeljs and browserified.\n\nLazit lets you do stuff like:\n\n```javascript\nlet lazit   = require('lazit');\nlet iterate = lazit.iterate;\nlet take    = lazit.take;\nlet zip     = lazit.zip;\nlet map     = lazit.map;\nlet result;\n\n// use infinite lists without any worries since everything is lazy\n// here `iterate` is an infinite list builder function\nresult  = [...take(4, zip(iterate(x =\u003e x+1, 0), map(v =\u003e v*v, [1,2,3,4,5,6,7,8])))];\nconsole.log(result); // [[0,1],[1,4],[2,9],[3,16]]\n\n// or stuff like\n\nlet f = (a,b) =\u003e { b = b.slice(); b.unshift(a); return b; };\nlet g = (a,b) =\u003e { a = a.slice(); a.unshift(b); return a; };\n\nconsole.log([...scanl(g, [], [1,2,3,4])]); // [[],[1],[2,1],[3,2,1],[4,3,2,1]]\nconsole.log(scanr(f, [], take(4, iterate(v =\u003e ++v, 1)))); // [[1,2,3,4],[2,3,4],[3,4],[4],[]]\n\n// or\n\nlet map  = lazit.map;\nlet take = lazit.take;\nconsole.log([...take(3, map(v =\u003e { if (v === 0) throw Error('Divide by zero error'); else return 1/v; }, [1,2,3,0,5]))]);\n// output is [ 1, 0.5, 0.3333333333333333 ]\n// it doesn't blow up since the evaluation is lazy\n```\n\nLazit exposes the same api whether you're dealing with infinite lists or finite lists. Also, the functions in lazit compose pretty much like they do in haskell, etc.\n\nAlso, all functions that require more than one argument auto-curry in lazit. So you can do stuff like:\n\n```javascript\nlet lazit    = require('lazit');\nlet mapIncFn = lazit.map(v =\u003e ++v); // pass only one out of the 2 args required by map\n\nconsole.log([...mapIncFn([1,2,3])]); // [2,3,4]\n```\n\nCurrent status: WIP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeusdeux%2Flazit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeusdeux%2Flazit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeusdeux%2Flazit/lists"}