https://github.com/karmaniverous/string-utilities
Handy tagged template functions & other string utilities.
https://github.com/karmaniverous/string-utilities
Last synced: 6 months ago
JSON representation
Handy tagged template functions & other string utilities.
- Host: GitHub
- URL: https://github.com/karmaniverous/string-utilities
- Owner: karmaniverous
- Created: 2024-08-23T10:05:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-09T03:04:21.000Z (6 months ago)
- Last Synced: 2025-07-09T22:51:10.746Z (6 months ago)
- Language: TypeScript
- Size: 564 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
> [API Documentation](https://karmaniverous.github.io/string-utilities) • [CHANGELOG](https://github.com/karmaniverous/string-utilities/tree/main/CHANGELOG.md)
# string-utilities
Handy tagged templates & other string utilities.
To install:
```bash
npm i @karmaniverous/string-utilities
```
Contents:
- Types
- [`Stringifiable`](https://docs.karmanivero.us/string-utilities/types/index.Stringifiable.html) - Represents any value with a `toString` method.
- [`stringifiableZodSchema`](https://docs.karmanivero.us/string-utilities/functions/index.stringifiableZodSchema.html) - Zod schema representing Stringifiable type.
- [`isStringifiable`](https://docs.karmanivero.us/string-utilities/functions/index.isStringifiable.html) - Returns `true` when value has `toString` method.
- Transformations
- [`normstr`](https://docs.karmanivero.us/string-utilities/functions/index.normstr.html) - Normalize a string by converting diacriticals to base characters, removing non-word characters, and converting to lower case. Non-strings return undefined.
- Tagged Template Functions
- Non-stringifiable to Empty String ([`n2e`](https://docs.karmanivero.us/string-utilities/functions/index.n2e.html)) - Replaces expressions without `toString` property with empty strings.
- Some Non-stringifiable to Empty String ([`sn2e`](https://docs.karmanivero.us/string-utilities/functions/index.sn2e.html)) - Returns empty string when any expression has no `toString` property.
- Some Non-stringifiable to Null ([`sn2n`](https://docs.karmanivero.us/string-utilities/functions/index.sn2n.html)) - Returns `null` when any expression has no `toString` property.
- Some Non-stringifiable to Undefined ([`sn2u`](https://docs.karmanivero.us/string-utilities/functions/index.sn2u.html)) - Returns `undefined` when any expression has no `toString` property.
- Higher-Order Functions
- Non-stringifiable to Default ([`n2d`](https://docs.karmanivero.us/string-utilities/functions/index.n2d.html)) - Returns tagged template function that replaces any expression that has no `toString` property with a default value.
- Some Non-stringifiable to Default ([`sn2d`](https://docs.karmanivero.us/string-utilities/functions/index.sn2d.html)) - Returns tagged template function that returns a default value when any expression has no `toString` property.
---
Built for you with ❤️ on Bali! Find more great tools & templates on [my GitHub Profile](https://github.com/karmaniverous).