dilan-dio4 / strz
💪 Very strongly typed string functions in TypeScript
strz
– Very Strongly Typed String Functions
-
0️⃣ No dependencies -
🌲 Tree shakable -
📦 Small -
5️⃣ Typescript 5 -
📝 Strongly typed
Why?
In projects that encourage strong typing, the standard library requires manually casting to match function parameter signatures. strz
brings the power of strong typing to the standard library.
Example
import { split, suffix } from 'strz'
const str = "The quick brown fox jumps over the lazy dog"
const splitStr = split(str, " ") // splitStr is of type ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]
const suffixed = suffix(str, "!") // suffixed is of type "The quick brown fox jumps over the lazy dog!"
Installation
npm install strz
Usage
import {
charAt,
toLowerCase,
toUpperCase,
toArray,
slice,
uncapitalize,
capitalize,
prefix,
suffix,
split,
trim,
trimStart,
trimEnd
…
Top comments (0)