{"id":18320634,"url":"https://github.com/lukasbach/noindent","last_synced_at":"2025-04-09T14:28:44.733Z","repository":{"id":50175386,"uuid":"373000630","full_name":"lukasbach/noindent","owner":"lukasbach","description":"Remove indentation from multiline strings, e.g. ones that were created with template literals","archived":false,"fork":false,"pushed_at":"2021-06-02T01:11:35.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T08:28:06.442Z","etag":null,"topics":["indent","indentation","literals","multiline","pretty","string","template","template-literals","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/noindent","language":"TypeScript","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/lukasbach.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":"2021-06-02T01:04:18.000Z","updated_at":"2021-11-13T19:44:59.000Z","dependencies_parsed_at":"2022-08-30T10:00:13.582Z","dependency_job_id":null,"html_url":"https://github.com/lukasbach/noindent","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/lukasbach%2Fnoindent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasbach%2Fnoindent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasbach%2Fnoindent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasbach%2Fnoindent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasbach","download_url":"https://codeload.github.com/lukasbach/noindent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054777,"owners_count":21040060,"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":["indent","indentation","literals","multiline","pretty","string","template","template-literals","utility"],"created_at":"2024-11-05T18:16:54.481Z","updated_at":"2025-04-09T14:28:44.708Z","avatar_url":"https://github.com/lukasbach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `noindent`\n\n[![Test](https://github.com/lukasbach/noindent/actions/workflows/test.yml/badge.svg)](https://github.com/lukasbach/noindent/actions/workflows/test.yml)\n\nAllows you to use multiline strings created with template literals that\nwere constructed with indentation. `noindent` cleans out the indentation,\nmaking the resulting string clean from inconsistent indentations while\nstill being easy to read on code.\n\nEasy to use with trivial interface, creates no additional dependencies,\nincludes typings and is tiny (616 bytes minified, 369 bytes gzipped).\n\n## Example\n\n```typescript\nimport noindent from 'noindent'\n\n(() =\u003e {\n  const result = noindent(`\n    Example input\n    \n    Usually, this would result in a string\n    that contains lots of unwanted whitespaces\n    \n      Which can lead to unwanted results if\n      the strings are used by whitespace-sensitive\n      code\n      \n    Or if the output is used as text where\n    whitespace is visible. \n  `)\n})()\n```\n\nproduces `result` (whitespaces and line breaks that\nare preserved are displayed as symbols):\n\n```\nExample·input⏎\n⏎\nUsually,·this·would·result·in·a·string⏎\nthat·contains·lots·of·unwanted·whitespaces⏎\n⏎\n··Which·can·lead·to·unwanted·results·if⏎\n··the·strings·are·used·by·whitespace-sensitive⏎\n··code⏎\n⏎\nOr·if·the·output·is·used·as·text·where⏎\nwhitespace·is·visible. \n```\n\nNote that further indentations, i.e. blocks of text that\nare further offset from the rest of the text, are preserved. Also,\nif the string is ended in a last line which only contains spaces, this\nline is omitted.\n\n## Installation\n\nInstall with `yarn add noindent` or `npm i noindent --save`,\nthen import with `import noindent from 'noindent'`\nor `const noindent = require('noindent')`.\n\n## Corner Cases\n\nVarious alternative syntax applications should work as well. The following\ncode snippets all produce the output\n\n```\nTest1⏎\nTest2⏎\n··Test3\n```\n\n### Text starts in first line\n\n```typescript\nimport noindent from 'noindent'\n\n(() =\u003e {\n  const result = noindent(`Test1\n    Test2\n      Test3\n  `)\n})()\n```\n\n### Text ends on last line with content\n\n```typescript\nimport noindent from 'noindent'\n\n(() =\u003e {\n  const result = noindent(`\n    Test1\n    Test2\n      Test3`)\n})()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasbach%2Fnoindent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasbach%2Fnoindent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasbach%2Fnoindent/lists"}