npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bearz/strings

v0.1.3

Published

A collection of string utilities to avoid extra allocations and enable case insensitivity comparisons.

Downloads

19

Readme

@bearz/strings

Overview

A collection of string utilities to avoid extra allocations and enable case insensitivity comparisons.

The comparions are functions like equal, startsWith, indexOf, etc. Each of those have both a normal version like equal and a case insensitive version like equalFold. which does a comparison without creating new string allocations using something like toLowerCase().

The case insensity should handle most of utf8 and more than just ascii or latin1 characters. e.g. equalFold("hello WÖrLD", "Hello wörld") returns true.

The string tranformations includes functions like singularize, dasherize, camelize, titleize, etc.

The basic checks functions include isNull, isEmpty, isSpace, isNullOrEmpty, and isNullOrSpace.

The trim methods can trim characters other than whitespace characters.

logo

JSR npm version GitHub version

Documentation

Documentation is available on jsr.io

A list of other modules can be found at github.com/bearz-io/js

Usage

import * from str from '@bearz/strings'

console.log(str.equalFold("left", "LeFT")); // true
console.log(str.equalFold("hello WÖrLD", "Hello wörld")); // true
console.log(str.equalFold("hello WÖrLD", "rld")); // false
console.log(str.trimEnd("my random text...", ".")); // my random text
console.log(str.underscore(" first-place")); // first_place
console.log(str.underscore(" first-place", { screaming: true })); // FIRST_PLACE

// useful for FFI
var sb = new str.StringBuilder()
sb.append("test \n")
   .append(new TextEncoder().encode(": another test \n"));
   .appendChar(33);

console.log(sb.toString())

Classes

  • StringBuilder - A builder for strings which does not use string concatination and instead uses numbers as runes and only builds the string when toString() is called.

Functions

  • camelize - converts a word to camel case.
  • capitalize - capitalizes a word.
  • dasherize - converts a word to hyphen/dash case.
  • endsWith - determines if a string or char array ends with characters.
  • endsWithFold - determines if a string or char array ends with characters using case insensitivity.
  • equalFold - determines if a string or char array with characeters.
  • equal - determines if a string or char array with characters.
  • indexOfFold - determines the index of a character or char array using case insensitivity.
  • indexOf - determines the index of of a character or char array.
  • lastIndexOfFolder - determines the last index of a character or char array using case insensitivity.
  • lastIndex - determines the last index of a character or char array.
  • ordinalize - converts word/number to the ordinal case.
  • pluralize - converts singular words to their plural counterpart.
  • pascalize - converts a word to pascal case.
  • singularize - converts pluralized words to their singular counterpart.
  • startsWith - determines if a string or char array starts with another char array.
  • startsWithFold - determines if a string or char array starts with another char array using case insensitivity.
  • titleize - converts characters into title case.
  • trim - trims the specified characters from the start and end of a char array. defaults to whitespace.
  • trimStart - trims the specified characters from the start of a char array. defaults to whitespace.
  • trimEnd - trims the specified characters from the end of a char array. defaults to whitespace.
  • toCharArray - converts a string to in array of characters/runes represented by a number.
  • toString - converts an array of characters into a string.
  • undercore - converts a word to use underscores. if the screaming option is set to true, then all letters are capitializeds.

LICENSE

MIT License

Pluralize and singularize comes from <github.com/dreamerslab/node.inflection> which is under the MIT LICENSE