{"name":"spacetrim","version":"0.9.0","keywords":[],"author":"","license":"SEE LICENSE IN LICENSE","_id":"spacetrim@0.9.0","homepage":"https://github.com/hejny/spacetrim#readme","bugs":{"url":"https://github.com/hejny/spacetrim/issues"},"dist":{"shasum":"1bd3e982c782c81a6bccac4021d7109019bb90ef","tarball":"http://registry-npm.ywwl.com/spacetrim/download/spacetrim-0.9.0.tgz","fileCount":97,"integrity":"sha512-sd9wQrg/NFeB0K9B1EHe9givtpuCZW5K4QHEkNCTcPAmpXqW1Rbt1OukZeoUapeDYQw2qtYCREHrMiEi8pSTHA==","signatures":[{"sig":"MEYCIQDtzCcuylX4ZaCrL54IpT8pGcKzgweAd9DPWH/5TfS/WgIhAPpe3pCx2OjzA56vL2WczgdlmW41k8+tS1KnPyAeuWep","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37521184,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjM0ktACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpB0g//Q+Qd0QXZaxySijt8o0WpT8iJ/sOTzjcGMagDWr+Bu8BTFapV\r\nknkYdMBU46VLi6CqKH3XTwu2mhXqvxHQikQs3ERJCo6q5KrO0UD0fMMyKYD8\r\nsSc7C13uQLzre0cA2sXBrVvx00b0+iGabMZhYkvMMIKysN5VlQ1IFpz73OBc\r\nVdaeLsh1gpZHxzSy24/pmWOJElOM40+Vd0nmr12JPXoVcNNBC0n2sLGVJiRb\r\nWd73VjyWs39kvQNi8uW6EjBGCUfP849SxG0Dx/wuCfn+YJpC8vHvAhwcZngZ\r\nJ8Csm9WNY4zR/kIsIsyfL+uqGZj4ZTn0SHd+IEOEBbzTKUxpwVErTM10295j\r\nlM8WVgSihXHGrtOBYdWAjUuEo88l57j3o3+5imD0LyP0AIqC0ERXflGJ0F+1\r\nqZBZ5db0p/qSXURXMEkyqoNJ26j0oXTfpnV+d7z+qmfi0o7EPsT8vzr3eeiB\r\nxT7tXQXTa7dO1LcTjt6engZG/seG8Yh91CRh5OLh93VYwUvB9DNepRkQ7EJ4\r\nJQ97zaeM+EWmW7CUEVybxHHNdas9Ow6wYJV9Vm/wjlI+9jEpGMczbixYP9Rz\r\n5xjSaBAvANlGBkTGNIzsrXMqIe39ZymyYeBWTn4nh0wf0zU0JZwdrOfTJT72\r\n8suXXvMXc2XPIH1tWsvbWxJWgXWbXhzMfuA=\r\n=LGM8\r\n-----END PGP SIGNATURE-----\r\n","size":37452994,"noattachment":false,"key":"/spacetrim/-/spacetrim-0.9.0.tgz"},"main":"./dist/umd/index.js","module":"./dist/esm/index.js","gitHead":"7a488f0ad8a755200ab8436a5cb6ac52365d1c96","scripts":{"lint":"tslint -p tsconfig.json","test":"jest","build":"rm -rf ./dist && rollup --config rollup.config.ts","preversion":"npm run lint && npm test","postversion":"git push && git push --tags"},"typings":"./dist/esm/typings/index.d.ts","_npmUser":{"name":"hejny","email":"me@pavolhejny.com"},"repository":{"url":"git+https://github.com/hejny/spacetrim.git","type":"git"},"_npmVersion":"8.11.0","description":"Spacetrim is trimming string from all 4 sides. It is very helpful to keep pretty code indentation without keeping a strange spaces inside a strings.","directories":{},"sideEffects":false,"_nodeVersion":"17.9.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"27.3.1","tslib":"2.3.1","rollup":"2.58.1","tslint":"6.1.3","ts-jest":"27.0.7","typescript":"4.4.4","@types/jest":"27.0.2","tslint-config-prettier":"1.18.0","@rollup/plugin-typescript":"8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/spacetrim_0.9.0_1664305452917_0.9871585296874621","host":"s3://npm-registry-packages"},"readme":"# ✂️ Space trim\n\n<!--Badges-->\n<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/800-badges/badges.ts so every manual change will be overwritten.-->\n\n\n[![License of Space trim](https://img.shields.io/github/license/hejny/spacetrim.svg?style=flat)](https://github.com/hejny/spacetrim/blob/main/LICENSE)\n[![NPM Version of Space trim](https://badge.fury.io/js/spacetrim.svg)](https://www.npmjs.com/package/spacetrim)\n[![Quality of package Space trim](https://packagequality.com/shield/spacetrim.svg)](https://packagequality.com/#?package=spacetrim)\n[![lint](https://github.com/hejny/spacetrim/actions/workflows/lint.yml/badge.svg)](https://github.com/hejny/spacetrim/actions/workflows/lint.yml)\n[![test](https://github.com/hejny/spacetrim/actions/workflows/test.yml/badge.svg)](https://github.com/hejny/spacetrim/actions/workflows/test.yml)\n[![Known Vulnerabilities](https://snyk.io/test/github/hejny/spacetrim/badge.svg)](https://snyk.io/test/github/hejny/spacetrim)\n[![Issues](https://img.shields.io/github/issues/hejny/spacetrim.svg?style=flat)](https://github.com/hejny/spacetrim/issues)\n[![Socket](https://socket.dev/api/badge/npm/package/spacetrim)](https://socket.dev/npm/package/spacetrim)\n\n<!--/Badges-->\n\nSpacetrim is trimming string from all 4 sides.\n\nIt is very helpful to keep pretty code indentation without keeping strange spaces inside a string.\n\n<!--Wallpaper-->\n<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src//workflows/315-ai-generated-wallpaper/4-aiGeneratedWallpaperUseInReadme.ts so every manual change will be overwritten.-->\n\n<!--\n[![Wallpaper of ✂️ Space trim](assets/ai/wallpaper/gallery/425d6259-2bb1-4173-99f8-a19c6b8254a5-0_0.png)](https://www.midjourney.com/app/jobs/425d6259-2bb1-4173-99f8-a19c6b8254a5)\n-->\n\n<!--/Wallpaper-->\n\n> ░ is whitespace and `spaceTrim` will trim the string at the boundaries ╔═╗\n\n```\n░░░░░░░░░░░░░\n░░░░░░░░░░░░░░\n░░░░░░░╔═════╗░\n░░░░░░░║Hello║░░\n░░░░░░░║Space║░░░\n░░░░░░░║Trim ║░░░░\n░░░░░░░╚═════╝░░░░░\n░░░░░░░░░░░░░░░░░░░░\n```\n\n## Usage\n\n```bash\nnpm i spacetrim\n```\n\n```typescript\nimport spaceTrim from 'spacetrim';\n\nconst trimmed = spaceTrim(`\n\n    Hello\n    Space\n    Trim\n\n\n`);\n\nconsole.log(trimmed);\n\n/*\nHello\nSpace\nTrim\n*/\n```\n\n_See more examples in [simple tests](./src/spaceTrim.test.ts)._\n\n## Nesting\n\nThis is very usefull when you want to trim multiline strings inside multiline strings.\n\n```typescript\nimport { spaceTrim } from 'spacetrim';\n\nconst trimmed = spaceTrim(\n    (block) => `\n\n        Numbers\n            ${block(['1', '2', '3'].join('\\n'))}\n        Chars\n            ${block(['A', 'B', 'C'].join('\\n'))}\n\n`,\n);\n\nconsole.log(trimmed);\n\n/*\nNumbers\n    1\n    2\n    3\nChars\n    A\n    B\n    C\n*/\n```\n\n_See more examples in [nesting tests](./src/nesting/nesting.test.ts)._\n\n## Asynchronous nesting\n\nYou can also trim multiline strings which are fetched asynchronously inside multiline strings.\n\n```typescript\nimport { spaceTrim } from 'spacetrim';\n\nconst trimmed = await spaceTrim(\n    async (block) => `\n\n        TypeScript:\n            ${await fetch('https://en.wikipedia.org/wiki/TypeScript').then(\n                (result) => result.text(),\n            )}\n\n\n`,\n);\n\nconsole.log(trimmed);\n\n/*\nTypeScript:\n    TypeScript is a free and open source programming language...\n*/\n```\n\n_See more examples in [asynchronous nesting tests](./src/nesting/async-nesting.test.ts)._\n\n<!--Contributing-->\n<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/810-contributing/contributing.ts so every manual change will be overwritten.-->\n\n## 🖋️ Contributing\n\nI am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).\n\nYou can also ⭐ star the spacetrim package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).\n\n<!--/Contributing-->\n\n<!--Partners-->\n<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/820-partners/partners.ts so every manual change will be overwritten.-->\n\n## ✨ Partners\n\n\n<a href=\"https://collboard.com/\" title=\"Collboard\"><img src=\"https://collboard.fra1.cdn.digitaloceanspaces.com/assets/18.12.1/logo-small.png#gh-light-mode-only\" alt=\"Collboard\" height=\"60\"/></a>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n<a href=\"https://webgpt.cz/?partner=ph&utm_medium=referral&utm_source=github-readme&utm_campaign=partner-ph\" title=\"WebGPT\"><img src=\"https://webgpt.cz/_next/static/media/webgpt-black.8d958d25.png#gh-light-mode-only\" alt=\"WebGPT\" height=\"60\"/></a>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n<a href=\"https://github.com/webgptorg/promptbook\" title=\"Promptbook\"><img src=\"https://raw.githubusercontent.com/webgptorg/promptbook/main/other/design/logo.png#gh-light-mode-only\" alt=\"Promptbook\" height=\"60\"/></a>\n\n\n[Become a partner](https://www.pavolhejny.com/contact/)\n\n<!--/Partners-->\n","publish_time":1664305453800,"maintainers":[{"name":"hejny","email":"pavol@hejny.org"}],"_cnpm_publish_time":1664305453800,"dist-tags":{"latest":"0.13.0"}}