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 🙏

© 2024 – Pkg Stats / Ryan Hefner

kolberg

v1.0.0

Published

Useful utilities for string searching and manipulation.

Downloads

4

Readme

Kolberg

Useful utilities for string searching and manipulation.

Build Status XO code style

Have you had to split a string into a few parts based on a certain character or keyword? Or maybe place a word between symbols? Such operations are common when building an expression parser or simply working with text. Kolberg aims to make it easier by providing a simple, human-readable API.


Features

  • Lightweight
  • Simple, human-readable API
  • Written in TypeScript

Install

$ npm install kolberg

Usage

import {get} from 'kolberg';

const result = get('the quick brown fox jumps over the lazy dog').between('the', 'dog')?.trim();

console.log(result); //=> 'lazy'

API

get(expression)

expression

Type: string

String, which you want to search or manipulate.

.before(identifier)

Get the contents of a string before identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, before which you want to receive the content.

.after(identifier)

Get the contents of a string after identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, after which you want to receive the content.

.between(firstIdentifier, secondIdentifier)

Get the contents of a string between identifiers. Returns a string or undefined.

firstIdentifier

Type: string | RegExp

The identifier, from which you want to search.

secondIdentifier

Type: string | RegExp

The identifier, to which you want to search.

remove(expression)

expression

Type: string

String, which you want to search or manipulate.

.before(identifier)

Remove the contents of a string before identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, before which you want to remove the content.

.after(identifier)

Remove the contents of a string after identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, after which you want to remove the content.

.between(firstIdentifier, secondIdentifier)

Remove the contents of a string between identifiers. Returns a string or undefined.

firstIdentifier

Type: string | RegExp

The identifier, from which you want to search.

secondIdentifier

Type: string | RegExp

The identifier, to which you want to search.

replace(expression)

expression

Type: string

String, which you want to search or manipulate.

.before(identifier, replaceWith)

Replace the contents of a string before identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, before which you want to replace the content.

replaceWith

Type: string

String, which you want to replace the content with.

.after(identifier, replaceWith)

Replace the contents of a string after identifier. Returns a string or undefined.

identifier

Type: string | RegExp

The identifier, after which you want to replace the content.

replaceWith

Type: string

String, which you want to replace the content with.

.between(firstIdentifier, secondIdentifier, replaceWith)

Replace the contents of a string between identifiers. Returns a string or undefined.

firstIdentifier

Type: string | RegExp

The identifier, from which you want to search.

secondIdentifier

Type: string | RegExp

The identifier, to which you want to search.

replaceWith

Type: string

String, which you want to replace the content with.

Why kolberg?

The name kolberg comes from a Polish etnographer, folklorist, and composer active during the foreign Partitions of Poland - Henryk Oskar Kolberg.

License

MIT