{"id":22710572,"url":"https://github.com/smallhelm/excerpt-at-line-col","last_synced_at":"2025-03-29T21:42:40.884Z","repository":{"id":57231632,"uuid":"41766976","full_name":"smallhelm/excerpt-at-line-col","owner":"smallhelm","description":"Get text excerpt that points to a given line and column number","archived":false,"fork":false,"pushed_at":"2015-09-01T23:34:27.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T22:28:06.703Z","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/smallhelm.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-09-01T22:35:29.000Z","updated_at":"2015-09-01T23:32:47.000Z","dependencies_parsed_at":"2022-09-04T15:04:46.480Z","dependency_job_id":null,"html_url":"https://github.com/smallhelm/excerpt-at-line-col","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/smallhelm%2Fexcerpt-at-line-col","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fexcerpt-at-line-col/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fexcerpt-at-line-col/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fexcerpt-at-line-col/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallhelm","download_url":"https://codeload.github.com/smallhelm/excerpt-at-line-col/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249226,"owners_count":20747167,"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-12-10T12:10:34.325Z","updated_at":"2025-03-29T21:42:40.863Z","avatar_url":"https://github.com/smallhelm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# excerpt-at-line-col\nGet text excerpt that points to a given line and column number\n\n# Example\na.txt\n```txt\none\ntwo\nthree\nfour\nfive\n```\nSome JS code\n```js\nvar excerptAtLineCol = require(\"excerpt-at-line-col\");\n\nvar text = require(\"fs\").readFileSync(\"./a.txt\").toString();\n\nconsole.log(excerptAtLineCol(text, 2, 2, 1));\n```\nHere's the output\n```txt\ntwo\nthree\n  ^\nfour\n```\n\n# API\n### excerptAtLineCol(text, line\\_n, col\\_n, n\\_surrounding\\_lines)\n * `text` - is the text you want to extract an excerpt from\n * `line_n` -  the line number, starting at 0\n * `col_n` - the column number, starting at 0\n * `n_surrounding_lines` - the number of surrounding lines you want it to show. Defaulting to 0, i.e. matching line only.\n\nReturns the excerpt string\n\n# License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Small Helm LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fexcerpt-at-line-col","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallhelm%2Fexcerpt-at-line-col","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fexcerpt-at-line-col/lists"}