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

@oxog/strkit

v1.0.0

Published

The ultimate zero-dependency string manipulation toolkit for JavaScript/TypeScript. 115+ methods across 10 categories with 4 flexible API styles, i18n support, and micro-kernel plugin architecture.

Readme

@oxog/strkit

The ultimate zero-dependency string manipulation toolkit for JavaScript/TypeScript.

npm version Bundle Size License: MIT

Features

  • Zero Dependencies - No external dependencies, everything implemented from scratch
  • 115+ Methods - Comprehensive string manipulation across 10 categories
  • 4 API Styles - Namespace, Direct Import, Chainable, and Prototype Extension
  • TypeScript First - Full TypeScript support with strict mode
  • Tree-Shakeable - Import only what you need
  • i18n Support - 14 locales with locale-aware operations
  • Plugin Architecture - Extend with custom plugins

Installation

npm install @oxog/strkit
yarn add @oxog/strkit
pnpm add @oxog/strkit

Quick Start

Style 1: Namespace API

import { str } from '@oxog/strkit';

str.case.camel('hello world');        // 'helloWorld'
str.validate.email('[email protected]');  // true
str.similarity.levenshtein('cat', 'bat'); // 1

Style 2: Direct Import (Tree-Shakeable)

import { camelCase, isEmail, levenshtein } from '@oxog/strkit';

camelCase('hello world');  // 'helloWorld'
isEmail('[email protected]');  // true
levenshtein('cat', 'bat'); // 1

Style 3: Chainable API

import { S } from '@oxog/strkit';

S('  Hello World  ')
  .trim()
  .camelCase()
  .truncate(8)
  .value; // 'helloW...'

// Immutable - each operation returns a new instance
const a = S('hello');
const b = a.upper();
console.log(a.value); // 'hello'
console.log(b.value); // 'HELLO'

Style 4: Prototype Extension (Opt-in)

import '@oxog/strkit/extend';

'hello world'.camelCase();  // 'helloWorld'
'[email protected]'.isEmail();  // true

Categories

Case Conversion

str.case.camel('hello world');     // 'helloWorld'
str.case.kebab('helloWorld');      // 'hello-world'
str.case.snake('helloWorld');      // 'hello_world'
str.case.pascal('hello world');    // 'HelloWorld'
str.case.title('hello world');     // 'Hello World'
str.case.constant('hello world');  // 'HELLO_WORLD'
str.case.upper('hello');           // 'HELLO'
str.case.lower('HELLO');           // 'hello'

// Locale support
str.case.upper('istanbul', { locale: 'tr' }); // 'İSTANBUL'

Manipulation

str.manipulation.trim('  hello  ');           // 'hello'
str.manipulation.truncate('hello world', 8);  // 'hello...'
str.manipulation.reverse('hello');            // 'olleh'
str.manipulation.wrap('hello', '"');          // '"hello"'
str.manipulation.between('<tag>', '<', '>');  // 'tag'
str.manipulation.before('hello@world', '@');  // 'hello'
str.manipulation.after('hello@world', '@');   // 'world'

Validation

str.validate.email('[email protected]');       // true
str.validate.url('https://example.com');      // true
str.validate.uuid('550e8400-e29b-...');       // true
str.validate.ip('192.168.1.1');               // true
str.validate.creditCard('4111111111111111');  // true
str.validate.json('{"key":"value"}');         // true

Sanitization

str.sanitize.slugify('Hello World!');         // 'hello-world'
str.sanitize.escapeHtml('<script>alert("xss")</script>');
// '&lt;script&gt;alert(&quot;xss&quot;)&lt;/script&gt;'
str.sanitize.stripHtml('<p>Hello <b>World</b></p>');  // 'Hello World'
str.sanitize.latinise('Héllo Wörld');         // 'Hello World'

Formatting

str.format.template('Hello, {{name}}!', { name: 'World' });
// 'Hello, World!'

str.format.sprintf('%s has %d apples', 'John', 5);
// 'John has 5 apples'

str.format.mask('1234567890', '(###) ###-####');
// '(123) 456-7890'

str.format.ordinalize(1);   // '1st'
str.format.ordinalize(2);   // '2nd'
str.format.ordinalize(3);   // '3rd'

Similarity

str.similarity.levenshtein('kitten', 'sitting');  // 3
str.similarity.dice('night', 'nacht');            // 0.25
str.similarity.jaroWinkler('DWAYNE', 'DUANE');    // 0.84
str.similarity.lcs('ABCDGH', 'AEDFHR');           // 'ADH'

str.similarity.bestMatch('hello', ['hallo', 'hullo', 'hey']);
// { match: 'hallo', score: 0.8, index: 0 }

Analysis

str.analysis.wordCount('Hello world');      // 2
str.analysis.charCount('Hello');            // 5
str.analysis.lineCount('a\nb\nc');          // 3
str.analysis.entropy('password');           // ~2.75
str.analysis.frequency('hello');            // { h: 1, e: 1, l: 2, o: 1 }

Pluralization

str.plural.plural('apple');           // 'apples'
str.plural.plural('child');           // 'children'
str.plural.plural('apple', 5, true);  // '5 apples'
str.plural.singular('apples');        // 'apple'
str.plural.isPlural('apples');        // true

Diff

str.diff.diffChars('hello', 'hallo');
// [{ type: 'equal', value: 'h' }, { type: 'remove', value: 'e' },
//  { type: 'add', value: 'a' }, { type: 'equal', value: 'llo' }]

str.diff.createPatch('file.txt', 'old', 'new');
// Unified diff format

Search

str.search.contains('hello world', 'world');     // true
str.search.indexOf('hello', 'l');                // 2
str.search.countOccurrences('abracadabra', 'a'); // 5
str.search.positions('abracadabra', 'a');        // [0, 3, 5, 7, 10]

i18n Support

import { setLocale, getLocale } from '@oxog/strkit';

setLocale('tr');
str.case.upper('istanbul');  // 'İSTANBUL'

// Per-operation locale
str.case.upper('istanbul', { locale: 'en' });  // 'ISTANBUL'
str.case.upper('istanbul', { locale: 'tr' });  // 'İSTANBUL'

Supported Locales

  • English (en) - default
  • Turkish (tr)
  • German (de)
  • French (fr)
  • Spanish (es)
  • Portuguese (pt)
  • Italian (it)
  • Dutch (nl)
  • Polish (pl)
  • Russian (ru)
  • Arabic (ar)
  • Chinese (zh)
  • Japanese (ja)
  • Korean (ko)

Plugin System

import { registerPlugin } from '@oxog/strkit';

const myPlugin = {
  name: 'myPlugin',
  version: '1.0.0',
  methods: {
    reverse: (str) => str.split('').reverse().join(''),
  },
};

registerPlugin(myPlugin);

TypeScript

Full TypeScript support with strict mode enabled:

import { S, str, type StrKitChain, type DiffResult } from '@oxog/strkit';

const chain: StrKitChain = S('hello');
const result: DiffResult[] = str.diff.diffChars('a', 'b');

License

MIT - see LICENSE for details.

Links