{"name":"spacetrim","version":"0.7.0","keywords":[],"author":"","license":"ISC","_id":"spacetrim@0.7.0","homepage":"https://github.com/hejny/spacetrim#readme","bugs":{"url":"https://github.com/hejny/spacetrim/issues"},"dist":{"shasum":"5d6eb667be7df562d6ea6f70e7d0a4af2a69cd81","tarball":"http://registry-npm.ywwl.com/spacetrim/download/spacetrim-0.7.0.tgz","fileCount":26,"integrity":"sha512-xZ0Cw/+yaIXz0XHimhdXpujkt9qHNrWuHwsfBBPTwjyGtSW/zF4bAkgAt+OXeXOUGWk5y8iSdqVqUW54MSHWUw==","signatures":[{"sig":"MEQCIFnuOxoFCOC7J7r3WzbavFioxAusy3JrbaRTJEAmSm5EAiAZPyZQfvhNnZZcPF8qZ6xW7gGPxjZcB/ICuCvsWGRpbA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1fdPCRA9TVsSAnZWagAA7C4QAJXChY/v5NRfxbEIbZNl\n5Nec77WaqJ1/Bs+qscx6HKXnp6hW1woDkzeQtQHHo29eadVsvHlK6WrxKrYo\nKRpc1zIqg0w/Oxl8Y9XuldDI9tQOFzLDUBut9oG4B7vmgCaMpPvwt/REdVA6\ncSEBQCnTDRgCKSWs4FDp7ADWr1MCrB/EBj+ubD/azV4leeXSGLL3XuWwzT9U\nvz283RicHEWYXPF4te4GkBKAXidyoWoVH6TkdhNdAMwPBs+MR6d1cjadzpHB\nMeLdea4CjSQbXphINkBjPW6dJXmQoLkYxms2SO/5b1GLXSQEs2SqO8gKF07+\nQx7gFumb8AjBuZvchHs9WReX0xYBEQSvllr1RDtEw57P8IA+9+D3f3gs8vS8\nksU5HIlWbK326Oe6f2Gc3VIR5fl+WhAqc0ISsuaLjKN3pPiYiACokwF90J3w\n5N/zvaD2gzN5UYS/peUJaos/yg7noc0UsB48r8p9cP9Rf3H/Raz7kqRx0lYI\nKlafNHmjPou5v+AQitjm/HzwBbuO6IMM26GNu+F1QcA7EzIyrvE6DWuR8fbZ\nKqoDQ+lYBKfbdgV9EYZLgq0GCcKEOms7Bi712QARbtrFrqGBsCd9kqMF1+xI\nS0xGcr8rY/e/jzN+pFs/48KUW+VD3whVjvUYwYCgTNreRwJsnRvztxaSAu2V\nALDj\r\n=nt0k\r\n-----END PGP SIGNATURE-----\r\n","size":9578,"noattachment":false,"key":"/spacetrim/-/spacetrim-0.7.0.tgz"},"main":"./dist/umd/spaceTrim.js","module":"./dist/esm/spaceTrim.js","gitHead":"e8116084fb559d9e19de560949676d5b3282e9fd","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/spaceTrim.d.ts","_npmUser":{"name":"hejny","email":"me@pavolhejny.com"},"repository":{"url":"git+https://github.com/hejny/spacetrim.git","type":"git"},"_npmVersion":"8.3.0","description":"Trimming string from all 4 sides","directories":{},"sideEffects":false,"_nodeVersion":"17.3.0","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.7.0_1641412431172_0.9839385126202","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":1641412431362,"maintainers":[{"name":"hejny","email":"pavol@hejny.org"}],"_cnpm_publish_time":1641412431362,"dist-tags":{"latest":"0.13.0"}}