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

@jaisocx/text

v2.2.2

Published

``` npm install @jaisocx/text ```

Readme

Text functions package

npm install @jaisocx/text

Status

Ready to use since the 06-th of May in the Year 2025.

The aim of the setup

I shall publish in this package some basic methods to work with string variables.

The aim of the setup is to keep the package little and reusable, installing via npm on demand with very few kilobytes cost.

Classes available

  1. Trimmer

  2. CaseConverter

Usage

1. Trimmer

import { Trimmer } from "@jaisocx/text";


let trimmer = new Trimmer();


// the text was:    ("Hello World!")
let strToTrim = "  (\"Hello World!\")  ";

// the text became: Hello World!
let trimmedText = trimmer.trimRoundBracesAndQuotesInside( strToTrim );


console.log( trimmedText );
// $> Hello World!

2. CaseConverter

Unicode case transformations for TypeScript/JavaScript.

For now just Latin base charset, 0 til 9, a til z and A til Z

Later Improvals

  1. the UC|LC methods may be improved via the very simple additions since the groups in marking time may have number enum value field charset range.

  2. in the enum CapsOrSmallTransformVariants.asIs, the same always marked arrays are groupped by numbers, caps and small letters, however with .asIs variant for time cost minimization the precise groupping processing cost may be saved up.

Examples

JavaScript

The vary base method .toDelimited()

// Sentence case:
let PascalCaseToSentenceCase: string = CaseConverter.getInstance()
  .toDelimited (
    "XMLHttpRequest",
    " ",
    CapsOrSmallTransformVariants.firstCapsAndSmall,
    CapsOrSmallTransformVariants.small,
    JoinDelimiterVariants.everyGroup
  );

console.log( PascalCaseToSentenceCase );

// $> Xml http request

new class instance

import { CaseConverter } from "@jaisocx/text";

const caseConverter = new CaseConverter();
let PascalCaseToSentenceCase = caseConverter.toSentence( "XMLHttpRequest" );

console.log( PascalCaseToSentenceCase );
// $> Xml http request

static call

import { CaseConverter } from "@jaisocx/text";

let PascalCaseToSentenceCase = CaseConverter.getInstance().toSentence( "XMLHttpRequest" );

// or like this:
PascalCaseToSentenceCase = CaseConverter.sentence( "XMLHttpRequest" );


console.log( PascalCaseToSentenceCase );
// $> Xml http request

TypeScript

new class instance

import { CaseConverter } from "@jaisocx/text";

const caseConverter: CaseConverter = new CaseConverter();
let PascalCaseToSentenceCase: string = caseConverter.toSentence( "XMLHttpRequest" );

console.log( PascalCaseToSentenceCase );
// $> Xml http request

static call

import { CaseConverter } from "@jaisocx/text";

let PascalCaseToSentenceCase: string = CaseConverter.getInstance().toSentence( "XMLHttpRequest" );

// or like this:
PascalCaseToSentenceCase = CaseConverter.sentence( "XMLHttpRequest" );

console.log( PascalCaseToSentenceCase );
// $> Xml http request

Interfaces

1. TrimmerInterface

export interface TrimmerInterface {

  trimSurroundingChars (
    inText: string,
    inSurroundingChars: string[][]
  ): string|false;


  trimQuotes( inText: string ): string|false;
  trimRoundBraces( inText: string ): string|false;
  trimRoundBracesAndQuotesInside( inText: string ): string|false;
  trimSquareBraces( inText: string ): string|false;
  trimSquareBracesAndQuotesInside( inText: string ): string|false;
  trimFiguredBraces( inText: string ): string|false;
  trimFiguredBracesAndQuotesInside( inText: string ): string|false;

}

2. CaseConverterInterface

import { DataRecordMatches } from "./CaseConverter.js";

export interface CaseConverterInterface {

  static getInstance(): CaseConverterInterface;

  setDebug( inDebug: boolean ): CaseConverterInterface

  static camel( inText: string ): string;
  static pascal( inText: string ): string;
  static snake( inText: string ): string;
  static kebab( inText: string ): string;
  static constant( inText: string ): string;
//static title( inText: string ): string;
  static sentence( inText: string ): string;
  static dot( inText: string ): string;
  static path( inText: string ): string;
  static train( inText: string ): string;



  toCamel(input: string): string;
  toPascal(input: string): string;
  toSnake(input: string): string;
  toKebab(input: string): string;
  toConstant(input: string): string;
  toSentence (input: string): string;
  toTrain (input: string): string;
  toAsPath (input: string): string;

  toUC( inText: string ): string;
  toFirstCapsAndSmall( inText: string ): string;
  toFirstCapsAsIs( inText: string ): string;
  toLC( inText: string ): string;

  toDelimited (
    inText: string,
    delimiter: string,
    capsOrSmallFirst_TransformVariants: number,
    capsOrSmallOther_TransformVariants: number,
    joinDelimiterVariant: number
  ): string;

  transformBitsbuf (
    inMarkedBitsbuf: Uint8Array,
    parseTimeDataRecord: DataRecordMatches,
    delimiter: string,
    inTransformFirstFunc: CallableFunction|false,
    inTransformFunc: CallableFunction|false
  ): string[];

  transformDataRecords (
    inParseTimeDataRecord: DataRecordMatches,
    joinDelimiterVariant: number
  ): DataRecordMatches;

  parseBitsbuf (
    inBitsbuf: Uint8Array
  ): DataRecordMatches;

  tasksParseTimeDataRecord (
    inOutDataRecord: DataRecordMatches,
    charPos: number
  ): void;

  matchesRanges ( aNum: number, inRanges: number[][] ): boolean;

  isNumLatin ( charCode: number ): boolean;
  isAlphaNumLatin ( charCode: number ): boolean;
  isUC ( charCode: number ): boolean;
  isLC ( charCode: number ): boolean;

}

Constants

export class CaseConverterConstants {

  static CapsOrSmallTransformVariants: ICapsOrSmallTransformVariants = {
    caps: 1,
    small: 2,
    firstCapsAndSmall: 3,
    firstCapsAsIs: 4,
    asIs: 5
  };



  static CharTypeEnum: ICharTypeEnum = {
    caps: 1,
    small: 2,
    num: 3,
    omitted: 4,
    delimiter: 5
  };



  static JoinDelimiterVariants: IJoinDelimiterVariants = {
    everyGroup: 3,
    beforeNumbersNoDelimiter: 4,
    afterNumbersNoDelimiter: 5,
    neverNumbersDelimiter: 6,
    delimitersReplaced: 7
  };



  static ParseTimeGrouppingVariants: IParseTimeGrouppingVariants = {
    numGrups: true,
    UcLcGroups: true,
    firstCapsGroups: true
  };



  static TransformVariants: ITransformVariants = {
    delimiter: "_",
    UcLcTransform: 5
  };

}

Enums and types

export type ICapsOrSmallTransformVariants = {
  caps: number,
  small: number,
  firstCapsAndSmall: number,
  firstCapsAsIs: number,
  asIs: number
}


// char type enum
export type ICharTypeEnum = {
  caps: number,
  small: number,
  num: number,
  omitted: number,
  delimiter: number
}


export type IJoinDelimiterVariants = {
  everyGroup: number,
  beforeNumbersNoDelimiter: number,
  afterNumbersNoDelimiter: number,
  neverNumbersDelimiter: number,
  delimitersReplaced: number
}


export type IParseTimeGrouppingVariants = {
  numGrups: boolean,
  UcLcGroups: boolean,
  firstCapsGroups: boolean
};


export type ITransformVariants = {
  delimiter: string,
  UcLcTransform: number
};


export type IDataRecordMatches = {

  groups_positions:            number[][],

  prev_CharTypeEnum:           number,
  current_CharTypeEnum:        number,

  currentGroupOfCharType_charsAmount: number

}