{"id":15445643,"url":"https://github.com/scriptnull/foreachline","last_synced_at":"2025-04-04T18:17:41.828Z","repository":{"id":33842948,"uuid":"37545410","full_name":"scriptnull/foreachline","owner":"scriptnull","description":"Do something for each line of a file with JS ","archived":false,"fork":false,"pushed_at":"2015-07-29T15:36:41.000Z","size":1736,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T02:38:58.425Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scriptnull.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-16T17:31:43.000Z","updated_at":"2015-06-16T19:48:50.000Z","dependencies_parsed_at":"2022-08-18T00:35:09.210Z","dependency_job_id":null,"html_url":"https://github.com/scriptnull/foreachline","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/scriptnull%2Fforeachline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fforeachline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fforeachline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fforeachline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptnull","download_url":"https://codeload.github.com/scriptnull/foreachline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226191,"owners_count":20904467,"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-01T19:45:34.458Z","updated_at":"2025-04-04T18:17:41.806Z","avatar_url":"https://github.com/scriptnull.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Click here for an Online version](http://scriptnull.github.io/foreachline)\n\n### Install \n```bash \nnpm install -g foreachline\n```\n\n### Usage \nIf you are a javascript fan who loves to do all your tasks with javascript , then foreachline is for you. \n\nTo use foreachline , you have to install it from npm and use the following command line.\n\n```bash \nforeachline src.txt logic.js \n```\nor \n\n```bash \nfel src.txt logic.js res.txt\n```\nUse ``foreachline`` or just ``fel`` .\n\n#### Arguments \n- ``src.txt`` - Source file for data.\n- ``logic.js`` - contains logic for mapping the data.\n- ``res.txt`` [Optional] - Results will be written to ``res.txt`` if specified , else will be written back to ``src.txt``.\n\n### What can you do ? \n Transform data . Be it a silly to-do list or 50 lines of code , map them  the way you want. \n \n Lets say you have the following source file ``src.txt``\n ```\nApple\nOrange\nBanana\n ```\n All you need to do is writing a JS file to map data on each line to new data. \n \n while creating a JS file , you just need to know one thing . foreachline provides you 2 variables to operate on your data.They are ``line`` and ``lineNumber``\n \n Lets say you want to add lines numbers on each line of ``src.txt``\n Then ``logic.js`` would look like \n ```javascript \n line = lineNumber + \".\" + line ;\n ```\n and you will have \n ```\n1.Apple\n2.Orange\n3.Banana\n```\n\n If you want to convert them to html list elements\n```javascript\nline = \"\u003cli\u003e\" + line + \"\u003c/li\u003e\" ; \n```\nand you will have \n```\n\u003cli\u003eApple\u003c/li\u003e\n\u003cli\u003eOrange\u003c/li\u003e\n\u003cli\u003eBanana\u003c/li\u003e\n```\n\nIf you want to create JavaScript objects \n```javasctipt \nline = { id : lineNumber , name : line };\n```\nand you will have \n```\n{\"id\":1,\"name\":\"Apple\"}\n{\"id\":2,\"name\":\"Orange\"}\n{\"id\":3,\"name\":\"Banana\"}\n```\n\nand I can continue giving examples all night.\n\n\n### Plans \nYeah ! We made it to the [web browser](http://scriptnull.github.io/foreachline)  , as per the plan. Right now , there is no  major plans for foreachline. \n\n### Contributing \nPlease visit the [project page](http://scriptnull.github.io/foreachline/#/contribute) to have idea about contibuting towards foreachline.\n\nWhatever you have in your mind , lets discuss. [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scriptnull/foreachline?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\n### License \nThis tool is licensed under the [MIT License](https://github.com/scriptnull/foreachline/blob/master/LICENSE). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fforeachline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptnull%2Fforeachline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fforeachline/lists"}