- 0οΈβ£ No dependencies
- π² Tree shakable
- π¦ Small
- 5οΈβ£ Typescript 5
- π Strongly typed
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.
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!"npm install strzimport {
charAt,
toLowerCase,
toUpperCase,
toArray,
slice,
uncapitalize,
capitalize,
prefix,
suffix,
split,
trim,
trimStart,
trimEnd,
replaceAll,
replace,
length,
} from 'strz'
const str = "The quick brown fox jumps over the lazy dog"
// Before
const char = str.charAt(0) // char is of type string
// After
const char = charAt(str, 0) // char is of type "T"
// Before
const replaced = str.replaceAll(" ", "_" ) // replaced is of type string
// After
const replaced = replaceAll(str, " ", "_" ) // replaced is of type "The_quick_brown_fox_jumps_over_the_lazy_dog"
// And so on...charAtβtoLowerCaseβtoUpperCaseβtoArrayβsliceβ- This is a partial implementation of
sliceand does not support negative indices
- This is a partial implementation of
uncapitalizeβcapitalizeβprefixβsuffixβsplitβtrimβtrimStartβtrimEndβreplaceAllβ- This is a partial implementation of
replaceAlland does not support regex
- This is a partial implementation of
replaceβ- This is a partial implementation of
replaceand does not support regex
- This is a partial implementation of
lengthβ