{"_id":"@alexgorbatchev/dedent-string","_rev":"3-d2fe3ac80842571eeccbaeacf53e159e","name":"@alexgorbatchev/dedent-string","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"@alexgorbatchev/dedent-string","version":"0.1.0","license":"MIT","_id":"@alexgorbatchev/dedent-string@0.1.0","maintainers":[{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"}],"homepage":"https://github.com/alexgorbatchev/dedent-string#readme","bugs":{"url":"https://github.com/alexgorbatchev/dedent-string/issues"},"dist":{"shasum":"1f6d14fe229a8db966e1ac9bbf0a19f83fe770a4","tarball":"https://registry.npmjs.org/@alexgorbatchev/dedent-string/-/dedent-string-0.1.0.tgz","fileCount":12,"integrity":"sha512-be11pcjStGbI4hFzWx9xT3BUwPfs4ymGT4GnDNEsMbFkpcb/6fTP63pyrEOpBbfXbo0QhaPBb4n6yJS/yUEU2w==","signatures":[{"sig":"MEQCIBg/2DSK7b+EU1VuohS7b93Nz5FkL8iL9M8a/1SVgrZ9AiB1CZB7nLIbQjldccW1IsXMmCW8kjiZMuRTLyUxQCXKlA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16951},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./dedentString":{"types":"./dist/dedentString.d.ts","import":"./dist/dedentString.js"},"./dedentTemplate":{"types":"./dist/dedentTemplate.d.ts","import":"./dist/dedentTemplate.js"}},"gitHead":"ec6cf7e07503b2a9891224c7f8c9e5a11eca1f28","scripts":{"test":"bun test","build":"bun build ./index.ts ./dedentString.ts ./dedentTemplate.ts --target=node --format=esm --outdir ./dist --entry-naming [name].js --sourcemap && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun run test && bun run typecheck"},"_npmUser":{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"},"repository":{"url":"git+https://github.com/alexgorbatchev/dedent-string.git","type":"git"},"_npmVersion":"11.9.0","description":"Dedent strings and interpolate multiline template placeholders while preserving indentation.","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/dedent-string_0.1.0_1775224791962_0.7512530527488177","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@alexgorbatchev/dedent-string","version":"1.0.0","license":"MIT","_id":"@alexgorbatchev/dedent-string@1.0.0","maintainers":[{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"}],"homepage":"https://github.com/alexgorbatchev/dedent-string#readme","bugs":{"url":"https://github.com/alexgorbatchev/dedent-string/issues"},"dist":{"shasum":"b676428412265ab47164b0a5c0f1ba4a324ced26","tarball":"https://registry.npmjs.org/@alexgorbatchev/dedent-string/-/dedent-string-1.0.0.tgz","fileCount":12,"integrity":"sha512-MByGK3ysCwIw+adEnGgI5w2a6oVCLrX/41LE0D6jQa83uLVkeZkhkfFW9I70selDmzcEVGNvnSC503xVa8l6eA==","signatures":[{"sig":"MEUCIBAn9YcYls2ugaMOUXlWaHpq4Q6EnZxOdiEjDRtvcY8dAiEAozYQPPW+9cKE0fD5YbUTjn02SX7p5GkldDZexVIhRUI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alexgorbatchev%2fdedent-string@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":16951},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./dedentString":{"types":"./dist/dedentString.d.ts","import":"./dist/dedentString.js"},"./dedentTemplate":{"types":"./dist/dedentTemplate.d.ts","import":"./dist/dedentTemplate.js"}},"gitHead":"35ea7973609b75c7a93636b552d6df4236c015ae","scripts":{"test":"bun test","build":"bun build ./index.ts ./dedentString.ts ./dedentTemplate.ts --target=node --format=esm --outdir ./dist --entry-naming [name].js --sourcemap && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun run test && bun run typecheck"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e9ebbeee-51ad-49ad-979c-1facaade5298"}},"repository":{"url":"git+https://github.com/alexgorbatchev/dedent-string.git","type":"git"},"_npmVersion":"11.9.0","description":"Dedent strings and interpolate multiline template placeholders while preserving indentation.","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/dedent-string_1.0.0_1775226642195_0.503862185577916","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alexgorbatchev/dedent-string","version":"1.0.1","description":"Dedent strings and interpolate multiline template placeholders while preserving indentation.","license":"MIT","homepage":"https://github.com/alexgorbatchev/dedent-string#readme","repository":{"type":"git","url":"git+https://github.com/alexgorbatchev/dedent-string.git"},"bugs":{"url":"https://github.com/alexgorbatchev/dedent-string/issues"},"publishConfig":{"access":"public"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./dedentString":{"types":"./dist/dedentString.d.ts","import":"./dist/dedentString.js"},"./dedentTemplate":{"types":"./dist/dedentTemplate.d.ts","import":"./dist/dedentTemplate.js"}},"sideEffects":false,"scripts":{"build":"bun build ./index.ts ./dedentString.ts ./dedentTemplate.ts --target=node --format=esm --outdir ./dist --entry-naming [name].js --sourcemap && tsc -p tsconfig.build.json && bun run verify:dist","test":"bun test","typecheck":"tsc --noEmit","verify:dist":"bun ./verifyDistExports.ts","prepublishOnly":"bun run build && bun run test && bun run typecheck"},"devDependencies":{"@types/bun":"latest","typescript":"^5.8.3"},"gitHead":"5be374301adbdd3ae6de6d9e4965c10fe037f466","_id":"@alexgorbatchev/dedent-string@1.0.1","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-B683zusFTrqzk7XhEr/zy6vDBH+kslFtQBuSl1miOglUG1dS3Xwoc7CBfmG1ygyuBFxOU+YM0XNdkhz2PWw6mQ==","shasum":"f46178052f92ae1e53071e0c2dcc602f949d5e38","tarball":"https://registry.npmjs.org/@alexgorbatchev/dedent-string/-/dedent-string-1.0.1.tgz","fileCount":12,"unpackedSize":26264,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alexgorbatchev%2fdedent-string@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDLIcRaxBUBdb5X0ZqWXLWzqk4j2qMTEHij4eYlsubPOAiAU0JjNfnlDSszU5P8HcbNbWZdLips4u19j7UvVCblbRg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e9ebbeee-51ad-49ad-979c-1facaade5298"}},"directories":{},"maintainers":[{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dedent-string_1.0.1_1776475676959_0.38294943476494026"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T13:59:51.875Z","modified":"2026-04-18T01:27:57.395Z","0.1.0":"2026-04-03T13:59:52.126Z","1.0.0":"2026-04-03T14:30:42.354Z","1.0.1":"2026-04-18T01:27:57.122Z"},"bugs":{"url":"https://github.com/alexgorbatchev/dedent-string/issues"},"license":"MIT","homepage":"https://github.com/alexgorbatchev/dedent-string#readme","repository":{"type":"git","url":"git+https://github.com/alexgorbatchev/dedent-string.git"},"description":"Dedent strings and interpolate multiline template placeholders while preserving indentation.","maintainers":[{"name":"alexgorbatchev","email":"alex.gorbatchev@gmail.com"}],"readme":"# @alexgorbatchev/dedent-string\n\nSmall string utilities for two closely related jobs:\n\n- `dedentString()` removes shared leading indentation from a block of text\n- `dedentTemplate()` dedents a template and replaces `{placeholders}`, including multiline values with preserved indentation\n\n## Installation\n\n```bash\nnpm install @alexgorbatchev/dedent-string\n```\n\n## Usage\n\n```ts\nimport dedentString, { dedentTemplate } from \"@alexgorbatchev/dedent-string\";\n\nconst text = dedentString(`\n    function hello() {\n      return \"world\";\n    }\n`);\n\nconsole.log(text);\n// function hello() {\n//   return \"world\";\n// }\n\nconst template = `\n  function main() {\n    {body}\n  }\n`;\n\nconst rendered = dedentTemplate(template, {\n  body: `if (ready) {\n  console.log(\"done\");\n}`,\n});\n\nconsole.log(rendered);\n// function main() {\n//   if (ready) {\n//     console.log(\"done\");\n//   }\n// }\n```\n\n## API\n\n### `dedentString(str: string): string`\n\nRemoves the smallest shared leading indentation from all non-empty lines, then trims leading and trailing blank lines.\n\nThis function is available as both the package default export and a named export.\n\n### `dedentTemplate(template: string, values: Record<string, string>): string`\n\nDedents the template first, then replaces placeholders in two modes:\n\n- inline placeholders like `Hello {name}`\n- standalone placeholders like `{body}` that can expand into multiline blocks while inheriting the line indentation\n\n## Development\n\n```bash\nbun install\nbun test\nbun run build\n```\n","readmeFilename":"README.md"}