{"id":17309292,"url":"https://github.com/wavebeem/oopsy-data","last_synced_at":"2025-03-27T00:21:57.060Z","repository":{"id":57314952,"uuid":"47476847","full_name":"wavebeem/oopsy-data","owner":"wavebeem","description":"Takes a file and error locations, turning them into line/column data with relevant text","archived":false,"fork":false,"pushed_at":"2015-12-06T03:48:07.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T03:49:25.470Z","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/wavebeem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-05T23:36:44.000Z","updated_at":"2015-12-06T01:30:37.000Z","dependencies_parsed_at":"2022-09-18T20:51:19.745Z","dependency_job_id":null,"html_url":"https://github.com/wavebeem/oopsy-data","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/wavebeem%2Foopsy-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavebeem%2Foopsy-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavebeem%2Foopsy-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavebeem%2Foopsy-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavebeem","download_url":"https://codeload.github.com/wavebeem/oopsy-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245756232,"owners_count":20667122,"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-15T12:28:04.082Z","updated_at":"2025-03-27T00:21:57.031Z","avatar_url":"https://github.com/wavebeem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oopsy-data\n\nThis package is designed to help you provide context for source code error\nmessages.\n\n## Code of Conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. By\nparticipating in this project you agree to abide by its terms.\n\n## API\n\n`fromIndices(code, indices, options)`\n\n`fromLocations(code, locations, options)`\n\nThere are two functions, `fromIndices`, and `fromLocations`. Both of them take\nthe source code text as a string for the first parameter. The second parameter\nis either a list of string indices (e.g. `[{index: 0}, {index: 5}`) or a list of\n`{line, column}` objects (e.g. `[{line: 1, column: 3}, {line: 3, column: 89}]`).\n\nIf the objects you pass have a property `data`, that will be passed along in the\nreturn values.\n\nThey both accept an optional third parameter which is an options object. The\nonly key for the options object is `color`, which can have the values true or\nfalse. This controls using the `chalk` library to colorize output.\n\nNOTE: The library considers both LF (Linux/OS X) and CRLF (Windows)\n\n## Example: No color, using indices:\n\n```javascript\nvar OopsyData = require(\"oopsy-data\");\nvar code =\n    \"hello world\\n\" +\n    \"this is me and cool\\n\" +\n    \"nice nice nice\\n\";\nvar indices = [\n    {index: 0},\n    {index: 2},\n    {index: 13}\n];\nvar data = OopsyData.fromIndices(code, indices);\ndata.forEach(function(d) {\n    console.log(\"Line:\", d.line, \"Column:\", d.column);\n    console.log(d.context);\n});\n```\n\n## Example: Color, using locations:\n\n```javascript\nvar OopsyData = require(\"oopsy-data\");\nvar code =\n    \"hello world\\n\" +\n    \"this is me and cool\\n\" +\n    \"nice nice nice\\n\";\nvar indices = [\n    {line: 1, column: 1},\n    {line: 2, column: 7},\n    {line: 3, column: 10}\n];\nvar data = OopsyData.fromLocations(code, locations, {color: true});\ndata.forEach(function(d) {\n    console.log(\"Line:\", d.line, \"Column:\", d.column);\n    console.log(d.context);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavebeem%2Foopsy-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavebeem%2Foopsy-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavebeem%2Foopsy-data/lists"}