{"name":"spacetrim","version":"0.6.2","keywords":[],"author":"","license":"ISC","_id":"spacetrim@0.6.2","homepage":"https://github.com/hejny/spacetrim#readme","bugs":{"url":"https://github.com/hejny/spacetrim/issues"},"dist":{"shasum":"3715f917f0d6a1144a75d6b675dde76e16eed38f","tarball":"http://registry-npm.ywwl.com/spacetrim/download/spacetrim-0.6.2.tgz","fileCount":24,"integrity":"sha512-BEb46CJrrzx7vhOdEcyrM5mz3+XZabrwVTVecX8G/1UJgst11xT0hQ/3Lb98Jk0E/2MfuKOm3qBOxVSeNhUMfA==","signatures":[{"sig":"MEYCIQDubXaG9fmZ0QtWv1rd5fGWcO0bL2FfNpmwjtWUVC0TQgIhAIF1844oZpsqInT2MRIDyLdERRLd+v7l5yRkD4tcCDrX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43320,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzu0PCRA9TVsSAnZWagAAmUIP/jr3VCbeDawRGdDm1Pn+\nW80NeakUjvlguUQsmXlCHRwe+vvwcL/ZLkKljk3YkyuK9Rq59nGn5nrOw+Gy\nj3ddrKVkDXeo5XjsJh/xrkn+1zpaHDZvRIpaTwu7Kd69leIIH5M8BmB68nrr\noZwvncZvW15z2J1oukGvIknmknjNXPFXPlE19xuZQJiyW1FWMa5bv2pPC2ae\n9yHKxpjmXaMqZIp6o9T2+RnhYDXXtZclP9W5ZyLw0C72+iSQJJuIZcNKQhlY\nrpacikhdCccJagvei1p5WS2RRRcVbNx93SjgA5Jja1XVVDXj4piSYwEQ2lBB\nNNJjBM0tynursIUtFMdD7jhZEv9U2Fi1dNqx/YtTTwaFs7JaRs6WilMub3U3\nLmS6gzx63wlHGQ5KAvrNn66h6TBOwE3KpJTEgkH4zOwGQ470279f866HEpAE\nholG3P+96ZOGi6uxE/gCBURfwr2eseonhnEbk1QjZJWGauqx2i482f/Rbdiv\nJu5D1DAG5K1Wc/mDeG3SLTJskAHvMtQt9rt+A5YDz/JclCyJ6A99x0REqUYy\nbAQT8ZEmc73s/Nw0arLb+2p0sNu1F60oIegclMntGLRJiv4lkMGOFIs7BGkJ\n4scEV0vxZlYtvaVYkefg2ZvSIApqhwBJq1x7gSfDuWvfMe9L0IBSQxFVNLh/\njn65\r\n=1TTU\r\n-----END PGP SIGNATURE-----\r\n","size":8712,"noattachment":false,"key":"/spacetrim/-/spacetrim-0.6.2.tgz"},"main":"./dist/umd/spaceTrim.js","module":"./dist/esm/spaceTrim.js","gitHead":"3a3576056a1356796b652324498196870445deb3","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.6.2_1640951055634_0.457230871006554","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":1640951055773,"maintainers":[{"name":"hejny","email":"pavol@hejny.org"}],"_cnpm_publish_time":1640951055773,"dist-tags":{"latest":"0.13.0"}}