{"id":29098178,"url":"https://github.com/2bigo/pythonic","last_synced_at":"2026-03-06T19:02:12.835Z","repository":{"id":150840263,"uuid":"75467379","full_name":"2bigO/pythonic","owner":"2bigO","description":"Python like utility functions for JavaScript: range, enumerate, zip and items.","archived":false,"fork":false,"pushed_at":"2019-03-10T10:50:22.000Z","size":31,"stargazers_count":31,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-21T22:57:19.725Z","etag":null,"topics":["functional","javascript","modules","python","pythonic","utilities"],"latest_commit_sha":null,"homepage":"","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/2bigO.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":"2016-12-03T10:31:55.000Z","updated_at":"2025-04-17T02:58:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5ddec3c-574b-41c8-8148-f3b3e1b069c0","html_url":"https://github.com/2bigO/pythonic","commit_stats":null,"previous_names":["assister-ai/pythonic","2bigo/pythonic","keyvan-m-sadeghi/pythonic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/2bigO/pythonic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2bigO%2Fpythonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2bigO%2Fpythonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2bigO%2Fpythonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2bigO%2Fpythonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2bigO","download_url":"https://codeload.github.com/2bigO/pythonic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2bigO%2Fpythonic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30192368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T18:54:55.862Z","status":"ssl_error","status_checked_at":"2026-03-06T18:53:04.013Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["functional","javascript","modules","python","pythonic","utilities"],"created_at":"2025-06-28T14:37:44.796Z","updated_at":"2026-03-06T19:02:12.805Z","avatar_url":"https://github.com/2bigO.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/pythonic.svg)](https://www.npmjs.com/package/pythonic)\n[![Build Status](https://api.travis-ci.org/assister-ai/pythonic.svg?branch=master)](https://travis-ci.org/assister-ai/pythonic)\n\n# Pythonic\n\nPython like utility functions for JavaScript: `range`, `enumerate`, `items`, `zip` and `zipLongest`.\n\nThese functions return an [`Iterator`](https://github.com/assister-ai/pythonic/blob/master/index.js#L1)\ninstance similar to [Python Iterators](https://wiki.python.org/moin/Iterator).\nThis `Iterator` implementation is lazy evaluated,\noffers [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),\n[`filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),\n[`reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n[`some`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some),\n[`every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every)\nand [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator)\ninterfaces.\n\n### Install\n```bash\nnpm install pythonic --save\n```\n\n### Functions\n\n#### range\n\n```javascript\nimport {range} from 'pythonic';\n\nrange(3).map(x =\u003e console.log(x + 1));\n// 1\n// 2\n// 3\n\nfor (const i of range(10, 25, 5))\n    console.log(i);\n// 10\n// 15\n// 20\n\nconsole.log(range(5).reduce((accumulator, current) =\u003e accumulator + current));\n// 10\n```\n\n#### enumerate\n\n```javascript\nimport {enumerate} from 'pythonic';\n\nconst arr = ['a', 'b'];\nfor (const [index, value] of enumerate(arr))\n    console.log(`index: ${index}, value: ${value}`);\n// index: 0, value: a\n// index: 1, value: b\n```\n\n#### zip | zipLongest\n\n```javascript\nimport {zip, zipLongest} from 'pythonic';\n\nconst arr1 = ['a', 'b'];\nconst arr2 = ['c', 'd', 'e'];\nfor (const [first, second] of zip(arr1, arr2))\n    console.log(`first: ${first}, second: ${second}`);\n// first: a, second: c\n// first: b, second: d\n\nfor (const [first, second] of zipLongest(arr1, arr2))\n    console.log(`first: ${first}, second: ${second}`);\n// first: a, second: c\n// first: b, second: d\n// first: undefined, second: e\n\n// unzip\nconst [arrayFirst, arraySecond] = [...zip(...zip(arr1, arr2))];\n```\n\n#### items\n\n```javascript\nimport {items} from 'pythonic';\n\nconst obj = {a: 'aa', b: 'bb'};\nfor (const [key, value] of items(obj))\n    console.log(`key: ${key}, value: ${value}`);\n// key: a, value: aa\n// key: b, value: bb\n\nconst map = new Map([[1, 'one'], [2, 'two']]);\nfor (const [key, value] of items(map))\n    console.log(`key: ${key}, value: ${value}`);\n// key: 1, value: one\n// key: 2, value: two\n```\n\n### Iterator\n```javascript\nimport {Iterator, range} from 'pythonic';\n\nconst randomIntegers = (size, start, stop) =\u003e new Iterator(function * () {\n    for (const _ of range(size))\n        yield Math.floor(Math.random() * (stop - start) + start);\n});\n\nconst randomNumbers = randomIntegers(3, 10, 1000);\n\nfor (const randomNumber of randomNumbers)\n    console.log(randomNumber);\n// 685\n// 214\n// 202\n\nconsole.log(randomNumbers.some(value =\u003e value \u003e 10));\n// true\nconsole.log(randomNumbers.every(value =\u003e value \u003c 1000));\n// true\n```\n\n### License\n\n[MIT](https://github.com/assister-ai/pythonic/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2bigo%2Fpythonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2bigo%2Fpythonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2bigo%2Fpythonic/lists"}