Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 14, 2023 03:00 pm GMT

strz Very Strongly Typed String Functions

GitHub logo 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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To