{"id":15931852,"url":"https://github.com/victornpb/tiny-dedent","last_synced_at":"2026-01-05T12:06:38.769Z","repository":{"id":65473123,"uuid":"330824362","full_name":"victornpb/tiny-dedent","owner":"victornpb","description":"A Tiny module for stripping indentation from multi-line strings. 150 bytes (min \u0026 gzipped)","archived":false,"fork":false,"pushed_at":"2024-07-24T18:25:37.000Z","size":212,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T14:57:31.099Z","etag":null,"topics":["dedent","deindent","es6","indentation","multi-line-string","multiline-strings","npm","npm-package","outdent","strip","template-literals","template-strings","trim"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/tiny-dedent","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victornpb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":["https://www.buymeacoffee.com/vitim"],"github":null,"patreon":null,"open_collective":null,"ko_fi":"victornpb","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null}},"created_at":"2021-01-19T00:55:32.000Z","updated_at":"2024-07-24T18:25:39.000Z","dependencies_parsed_at":"2024-06-21T13:14:40.551Z","dependency_job_id":"a0f0a12f-499d-4d82-aaa3-af549392a316","html_url":"https://github.com/victornpb/tiny-dedent","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"f8c768f572f284467ef7a8feecfcb2aeb3e800f8"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Ftiny-dedent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Ftiny-dedent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Ftiny-dedent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Ftiny-dedent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victornpb","download_url":"https://codeload.github.com/victornpb/tiny-dedent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245164324,"owners_count":20571105,"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":["dedent","deindent","es6","indentation","multi-line-string","multiline-strings","npm","npm-package","outdent","strip","template-literals","template-strings","trim"],"created_at":"2024-10-07T01:40:34.236Z","updated_at":"2026-01-05T12:06:38.722Z","avatar_url":"https://github.com/victornpb.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/vitim","https://ko-fi.com/victornpb"],"categories":[],"sub_categories":[],"readme":"# tiny-dedent\n\n![Node](https://img.shields.io/node/v/tiny-dedent.svg?style=flat-square)\n[![NPM](https://img.shields.io/npm/v/tiny-dedent.svg?style=flat-square)](https://www.npmjs.com/package/tiny-dedent)\n[![NPM](https://img.shields.io/npm/dt/tiny-dedent.svg?style=flat-square)](https://www.npmjs.com/package/tiny-dedent)\n\nA Tiny module for stripping indentation from multi-line strings.\n\n- It's tiny! 4 lines of code, **150 bytes** (gzipped)\n- No dependencies!\n- It's Fast!\n\n## Installation\n\n### [Yarn](https://github.com/yarnpkg/yarn)\n\n    yarn add tiny-dedent\n\n### NPM\n\n    npm install tiny-dedent\n\n### CDN\n\nIf you don't use a package manager, you can [access `tiny-dedent` via unpkg (CDN)](https://unpkg.com/tiny-dedent/), download the source, or point your package manager to the url.\n\n- https://unpkg.com/tiny-dedent/\n\n## Usage\n\n```js\nimport S from \"tiny-dedent\";\n\nfunction usageExample() {\n  const first = S(`A string that gets so long you need to break it over\n                       multiple lines. Luckily tiny-dedent is here to keep it\n                       readable without lots of spaces ending up in the string\n                       itself.`);\n```\n\n```\nA string that gets so long you need to break it over\nmultiple lines. Luckily tiny-dedent is here to keep it\nreadable without lots of spaces ending up in the string\nitself.\n```\n\n```js\nconst second = S(`\n    Leading and trailing lines will be trimmed, so you can write something like\n    this and have it work as you expect:\n\n      * how convenient it is\n      * that I can use an indented list\n         - and still have it do the right thing\n\n    That's all.\n  `);\n```\n\n```\nLeading and trailing lines will be trimmed, so you can write something like\nthis and have it work as you expect:\n\n  * how convenient it is\n  * that I can use an indented list\n    - and still have it do the right thing\n\nThat's all.\n\nWait! I lied. Dedent can also be used as a function.\n```\n\n## Motivation\n\nI've been writting this replace regex over and over at the end of every template literal string, then I found there's a pretty popular package called dedent, which does exactly that. But I didn't feel like adding a dependency to do something that should be a macro, so I wrote this as a simple function.\n\nThis library is meant to be kept really really simple. It does not try to handle any edge cases, if you need something something more sophisticated take a look at the [dedent](https://www.npmjs.com/package/dedent) package, it is around ~50 lines (tiny-dedent is 4).\n\n## Why not a tagged function?\n\nA tagged function has to manually make the interpolations, instead of running it natively. Passing the string it as regular function parameter leaves the hard work for the javascript engine instead of doing it in userland, in theory it should be faster, and you need ship less code.\n\n## Suggestions / Questions\n\nFile a [issue](https://github.com/victornpb/getComments.js/issues) on this repository\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Ftiny-dedent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictornpb%2Ftiny-dedent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Ftiny-dedent/lists"}