New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

strz

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strz

- 0️⃣ No dependencies - 🌲 Tree shakable - 📦 Small - 5️⃣ Typescript 5 - 📝 Strongly typed

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

strzVery 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,
  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...

API

  • charAt
  • toLowerCase
  • toUpperCase
  • toArray
  • slice
    • This is a partial implementation of slice and does not support negative indices
  • uncapitalize
  • capitalize
  • prefix
  • suffix
  • split
  • trim
  • trimStart
  • trimEnd
  • replaceAll
    • This is a partial implementation of replaceAll and does not support regex
  • replace
    • This is a partial implementation of replace and does not support regex
  • length

FAQs

Package last updated on 13 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts