{"id":22828679,"url":"https://github.com/busterc/lbl","last_synced_at":"2025-03-31T01:18:01.041Z","repository":{"id":74997392,"uuid":"139466573","full_name":"busterc/lbl","owner":"busterc","description":":heavy_dollar_sign: Process stdin, line by line, sort of like AWK but 100% JS","archived":false,"fork":false,"pushed_at":"2018-08-25T22:01:34.000Z","size":69,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T11:46:01.840Z","etag":null,"topics":["awk","byline","cli","console-log","eval","gawk","grep","javascript","line-by-line","line-reader","lines","print","sed","split","stdin","stdio"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/busterc.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-07-02T16:19:17.000Z","updated_at":"2023-09-08T17:42:23.000Z","dependencies_parsed_at":"2023-03-13T20:16:45.752Z","dependency_job_id":null,"html_url":"https://github.com/busterc/lbl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Flbl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Flbl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Flbl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/busterc%2Flbl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/busterc","download_url":"https://codeload.github.com/busterc/lbl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399803,"owners_count":20770909,"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":["awk","byline","cli","console-log","eval","gawk","grep","javascript","line-by-line","line-reader","lines","print","sed","split","stdin","stdio"],"created_at":"2024-12-12T19:11:24.890Z","updated_at":"2025-03-31T01:18:01.022Z","avatar_url":"https://github.com/busterc.png","language":"JavaScript","readme":"# lbl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]\n\n\u003e Process stdin, line by line, sort of like AWK but 100% JS\n\n## Prerequisites\n\n- There are a couple of handy globals available\n  - `$` is an alias for `global`\n  - `log` is an alias for `console.log`\n  - `chalk` is available for adding color to ouput\n\n## Installation\n\n```sh\n$ npm install lbl --global\n```\n\n## Usage\n\n```sh\nUsage\n\n  $ lbl \u003cOptions\u003e \u003cSTDIN\u003e\n\nOptions\n\n  # Pass processing functions on CLI\n  -a, --after     function to run after processing lines [optional]\n  -b, --before    function to run before processing lines [optional]\n  -e, --each      function to run on each line [required]\n\n  # Or, use a node module file with processing functions:\n  # before(), after(), each()\n  -r, --require   module file with functions\n\n  -h, --help      show this usage info\n  --version       show the current version installed\n\nExamples\n\n  $ cat ./data/x.file | lbl -r ./scripts/X.js\n  \u003c\u003cBEGIN\u003e\u003e\n  \u003e XX\n  \u003e Matched 1 from 3\n\n  $ printf 'x\\\\nXX\\\\nxXx' | lbl -e 'x =\u003e { n++; if (x.match(/^X/)) { log(chalk.yellow('\u003e ') + x); f++; } }' -b '() =\u003e { $.n = 0; $.f = 0; log('\u003c\u003cBEGIN\u003e\u003e'); }' -a '() =\u003e { log('\u003e Matched ' + f + ' from ' + n); }'\n  \u003c\u003cBEGIN\u003e\u003e\n  \u003e XX\n  \u003e Matched 1 from 3\n```\n\n### Sample Module File\n\n```js\n'use strict';\n/* global $, log, chalk, n:true, f:true */\n\nmodule.exports = {\n  each: x =\u003e {\n    n++;\n    if (x.match(/^X/)) {\n      log(chalk.yellow('\u003e ') + x);\n      f++;\n    }\n  },\n  before: () =\u003e {\n    $.n = 0;\n    $.f = 0;\n    log('\u003c\u003cBEGIN\u003e\u003e');\n  },\n  after: () =\u003e {\n    log('\u003e Matched ' + f + ' from ' + n);\n  }\n};\n```\n\n## License\n\nISC © [Buster Collings]()\n\n[npm-image]: https://badge.fury.io/js/lbl.svg\n[npm-url]: https://npmjs.org/package/lbl\n[travis-image]: https://travis-ci.org/busterc/lbl.svg?branch=master\n[travis-url]: https://travis-ci.org/busterc/lbl\n[daviddm-image]: https://david-dm.org/busterc/lbl.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/busterc/lbl\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusterc%2Flbl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbusterc%2Flbl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusterc%2Flbl/lists"}