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

@cthru/bastr

v0.3.3

Published

CLI string manipulation utility

Readme

bastr

CLI string manipulation utility

oclif Version Downloads/week License

Description

bastr takes stdin content and provide functions to modify the content. It is meant as an alternative to using sed, tr, awk and other utilities for simple string and array manipulation.

The unix utilities are probably more performant and more powerful - this utility only exists because it is easier and more semantic to use.

Advanced Use: Scripts

Scripts in bastr are sequences of predefined actions. To create a new script, use the bs script:add command and follow along with the prompts

To list your scripts, use bs script:list.

To apply a script, use (someprocess) | bs script [scriptname]

Examples

$ echo -n "capitalize all words" | bs split " " | bs capitalize | bs join " "
>>> Capitalize All Words
$ ps | bs lineArray | bs findItem bash | bs getItem 0 | bs split -r "\s+" | bs getItem 3
>>> /usr/local/bin/bash

Usage

$ npm install -g @cthru/bastr
$ (someProcess) | bs COMMAND
running command...
$ bs (-v|--version|version)
@cthru/bastr/0.3.3 darwin-x64 node-v10.10.0
$ bs --help [COMMAND]
USAGE
  $ (someProcess) | bs COMMAND
...

Commands

(someProcess) | bs capitalize

Capitalizes string or [string]

USAGE
  $ (someProcess) | bs capitalize

OPTIONS
  -a, --all           Target all letters, not just first
  -d, --decapitalize  De-Capitalize instead

ALIASES
  $ (someProcess) | bs cap

See code: src/commands/capitalize.js

(someProcess) | bs findItem TERM

Get an Item from an array, or a character from a string

USAGE
  $ (someProcess) | bs findItem TERM

ARGUMENTS
  TERM  The term to search for

ALIASES
  $ (someProcess) | bs search
  $ (someProcess) | bs filter
  $ (someProcess) | bs find

See code: src/commands/findItem.js

(someProcess) | bs getItem [INDEX]

Get an Item from an array, or a character from a string

USAGE
  $ (someProcess) | bs getItem [INDEX]

ARGUMENTS
  INDEX  Zero-based index for the array item to select

ALIASES
  $ (someProcess) | bs get

See code: src/commands/getItem.js

(someProcess) | bs help [COMMAND]

display help for bs

USAGE
  $ (someProcess) | bs help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

(someProcess) | bs join [GLUE]

Join multiple array elements together

USAGE
  $ (someProcess) | bs join [GLUE]

ARGUMENTS
  GLUE  [default:  ] Glue to use for join

See code: src/commands/join.js

(someProcess) | bs replace SEARCHTERM REPLACETERM

Replaces Values in strings or arrays

USAGE
  $ (someProcess) | bs replace SEARCHTERM REPLACETERM

ARGUMENTS
  SEARCHTERM   The term to search for
  REPLACETERM  The term to replace searchTerm with

OPTIONS
  -c, --case-sensitive  match only case sensitive occurances
  -f, --first           only replace the first occurance
  -r, --regex           use regular expression in search term

See code: src/commands/replace.js

(someProcess) | bs script [SCRIPTNAME]

Apply a script to bash output

USAGE
  $ (someProcess) | bs script [SCRIPTNAME]

ARGUMENTS
  SCRIPTNAME  The script you want to apply

OPTIONS
  -s, --show-cli-equivalent  Show what this script would look like on bash

See code: src/commands/script/index.js

bs script:add

Add a new Script

USAGE
  $ bs script:add

See code: src/commands/script/add.js

bs script:delete SCRIPTNAME

Delete a named script

USAGE
  $ bs script:delete SCRIPTNAME

ARGUMENTS
  SCRIPTNAME  delete the `scriptName` script

See code: src/commands/script/delete.js

bs script:list

List your Scripts

USAGE
  $ bs script:list

See code: src/commands/script/list.js

(someProcess) | bs select INDEXES

Selects array items by index list

USAGE
  $ (someProcess) | bs select INDEXES

ARGUMENTS
  INDEXES  A list of indexes delimited by comma. Eg. '1,2,3' and '-3,5,6-'

See code: src/commands/select.js

(someProcess) | bs split DELIMITER

Split a string into an array based on a delimiter

USAGE
  $ (someProcess) | bs split DELIMITER

ARGUMENTS
  DELIMITER  [default:  ] Delimiter to use as split point

OPTIONS
  -r, --regex  Delimiter is regex

See code: src/commands/split.js

(someProcess) | bs toArray

Split multiline string into array of lines

USAGE
  $ (someProcess) | bs toArray

ALIASES
  $ (someProcess) | bs lineSplit
  $ (someProcess) | bs line2array
  $ (someProcess) | bs lineArray

See code: src/commands/toArray.js

(someProcess) | bs trim TRIMCHAR

Trim a string or an array of strings

USAGE
  $ (someProcess) | bs trim TRIMCHAR

ARGUMENTS
  TRIMCHAR  [default:  ] The character to trim

OPTIONS
  -s, --sides=left|right|both  [default: both] Configure which side(s) to trim

See code: src/commands/trim.js