An Interest In:
Web News this Week
- April 3, 2024
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
April 14, 2023 03:00 pm GMT
Original Link: https://dev.to/dio41020/strz-very-strongly-typed-string-functions-58on
strz Very Strongly Typed String Functions
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
Original Link: https://dev.to/dio41020/strz-very-strongly-typed-string-functions-58on
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To