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

jrep1

v0.6.0

Published

A new generation grep that uses Javascript

Readme

jrep

Version CircleCI Downloads/week License

A new generation grep written in node/javascript.

Think of awk & sed with javascript syntax.

Very useful for bash scripting and devops works. Very handy and extermly flexible.

🧤 Usage

jrep <filter1> <filter2> ...

  • Each <filter>
    • is a string transformation (a map callback)
    • is the body of a javascript function with arg x
  • The s are applied sequentially on each line in the piped content.
  • In case of exception in any of the s, that line is removed.

🎩 Built-in primitives

| primitive |meaning| usage | | ----------- |----| ----------- | | ✨ RE1 ✨ |find/replace regexp| RE1( <regular expression with parentheses> ) | | ✨ RER ✨ |find + custom replace| RER( regexp. , a string with p[1],p[2], ... ) | | || |

⌨️ Example

uname -a | jrep 'x.replace(/a/g, "O")'

⛑ Practical examples

  • Extract pids ps aux|jrep 'x.substring(12,24)'
  • Extract the filenames in a find command:
find .| jrep '/([^\/]*)$/.exec(x)[1]'
  • Using env for filter names: Another way to write it is to use bash env vars for filter names. It is will be also more reusable. A more readable notation:
EXTRACT_BASENAME='/([^\/]*)$/.exec(x)[1]'
find / | jrep $EXTRACT_BASENAME | head
  • The PSAUX_PID can extract the PID from the output of the commonly used ps aux command (tested on MacOS). Is can be used to extract other columns
PSAUX_PID='[.../([^ ]*) * (\d*) *(\d+\.\d+) *(\d+\.\d+) *(\d+) *(\d+) *([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +(.*)$/.exec(x)].slice(1)[1]'
ps aux | jrep "$PSAUX_PID"
  • Another usage of PSAUX_PID:
ps aux | grep -v grep | grep http-server | jrep "$PSAUX_PID" | xargs kill
  • Emulate cut command: ps aux|jrep 'x.substring(12,24)'
  • Pairs of pid and their running time:
ps aux|jrep "{time=x.substring(70,78); pid=x.substring(15,24); return pid+':'+time;}"
  • Sort PIDs based on runing time:
ps aux|jrep "{time=x.substring(70,78); pid=x.substring(15,24); return time + ':' + pid;}"|sort
  • Replace letters with frog: (such a useful scenario)
uname -a | jrep 'x.replace(/[a-z]/g, "🐸")'
  • Using ✨ built-in primitives: RE1 ✨. The following two are equivalent:
ps aux | jrep 'RE1(".*(python.*)")'
ps aux | jrep '/.*(python.*)/.exec(x)[1]'
  • The following three are equivalent
ps aux | jrep 'RE1("(.*python.*)")'
ps aux | jrep '/(.*python.*)/.exec(x)[1]'
ps aux | grep -e python
  • Using ✨ built-in primitive RER ✨. Replace python in filenames with emojies.
find .. | jrep 'RER("(.*)python(.*)", "p[1]+\"🐍🐍\"+p[2]")'

🐻 Find jrep on npm: jrep1

💡 Some suggested use cases

  • Eliminate usage of obscure aommands such as awk, sed, perl
  • Unified solution without usual tools cut, grep
  • Replace a matched regular expression with given custom ccombination (See RER)
  • Extract part of an RE1 pattern (See RE1)

🤝

  • 👋 Feel free to send Pull Requests.
  • 👋 Feel free to request features.

✨ Pros

  • 👍 transform (map) text in linux pipes
  • 👍 filter text in linux pipes
  • 👍 concise
  • 👍 versatile
  • 👍 exteremly flexible
  • 👍 customisable
  • 👍 prebuilt primitive operations
  • 👍 Super lightweight
  • 👍 Zero npm dependencies
  • 👍 Docker version available

Cons

  • 👎 Needs node installed on the system. 👍 If you don't want to install node, an alternative is to use docker.

📌 Requirements

  • NodeJS (tested on node 12 and node v16.15.0)

💻 Installation

  • 🐻 npm
npm i -g jrep1
# test:
uname -a | jrep 'x.replace("a", "O")'
  • 💻 MacOS , Linux
git clone https://github.com/sohale/jrep.git
./jrep/scripts/install-macos.bash
npm install -g jrep
  • 🐱 yarn
yarn install -g jrep

📚 Example Usage

Also see test/e2e-test.bash

  • 🐳 docker No need to install Node
find / | \
    docker run -i sohale/jrep:latest \
       '/\/([^\/]*\.py)$/.exec(x)[1]'
  • ⌨️ npx
uname -a | npx jrep 'x.replace("a", "O")'
  • 📡 bash (on the fly)
find .. | \
    node -e "$(curl -L https://raw.githubusercontent.com/sohale/jrep/main/src/jrep.js | tail -n +2))" '' \
       '/\/([^\/]*\.py)$/.exec(x)[1]'
  • requires NodeJS (tested on node 12) to be installed on your system.

💻 Development ⌨️

docs/internals.md

📚 Tutorial

(comming soon)