{"id":15945588,"url":"https://github.com/ig3/dedent","last_synced_at":"2026-01-19T02:02:14.091Z","repository":{"id":251664414,"uuid":"838084229","full_name":"ig3/dedent","owner":"ig3","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-04T22:29:47.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T03:40:30.026Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ig3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-04T22:22:45.000Z","updated_at":"2024-08-04T22:29:50.000Z","dependencies_parsed_at":"2024-08-04T22:43:27.330Z","dependency_job_id":"6f541381-be02-4707-8aa9-b9afefd589eb","html_url":"https://github.com/ig3/dedent","commit_stats":null,"previous_names":["ig3/dedent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ig3/dedent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fdedent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fdedent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fdedent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fdedent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ig3","download_url":"https://codeload.github.com/ig3/dedent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fdedent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28557784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T00:46:33.223Z","status":"online","status_checked_at":"2026-01-19T02:00:08.049Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-07T09:04:14.152Z","updated_at":"2026-01-19T02:02:14.069Z","avatar_url":"https://github.com/ig3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @ig3/dedent\n\nA plain JavaScript CJS module remove excess indent from multi-line strings,\nwithout dependencies.\n\nWhen using template strings to create multi-line strings in an indented\ncode block, to maintain indent within the code block, the lines of the\nstring template might also be indented, but this produces a string with too\nmuch indent.\n\n`dedent(str)` can be used to remove such excess indent.\n\n## install\n\n```\n$ npm install @ig3/dedent\n```\n\n## usage\n\n```\nconst dedent = require('@ig3/dedent');\n\nfunction getString () {\n    return `\n      This is a multi-line string.\n      It should be indented by two spaces.\n      But because the string template is in an indented code block,\n      with each line indented by four spaces,\n      to maintain indent within the code block,\n      each line is indented by six spaces.\n      Using dedent() removes the extra indentation.\n    `;\n}\n\nconsole.log(dedent(getString()));\n```\n\nThis produces:\n\n```\n  This is a multi-line string.\n  It should be indented by two spaces.\n  But because the string template is in an indented code block,\n  with each line indented by four spaces,\n  to maintain indent within the code block,\n  each line is indented by six spaces.\n  Using dedent() removes the extra indentation.\n```\n\nIt handles a mix of tabs and spaces in the indent, as long as the indent is\nconsistent from line to line. If some lines use tabs and others use spaces\nor the order of tabs and spaces is variable, then the result will be\nincorrect.\n\nLeading '\\n' and trailing line empty except for the indent are removed.\n\nIf the last line is not empty except for the indent, a heuristic is used to\ndetermine the indent: testing each line of the string to find the shortest\n(number of characters) prefix of spaces and/or tabs, and this prefix is\nremoved. Scanning all lines of the string takes additional time and might\ngive unexpected results.\n\nSingle-line strings (i.e. without any '\\n' character) are returned\nunchanged.\n\nThrows an exception if the passed value is not a string;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fig3%2Fdedent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fig3%2Fdedent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fig3%2Fdedent/lists"}