Luke Oliff.

Any TILs from your package managers library recently?

·Opensource·3 min read·Luke Oliff

Any TILs from your package managers library recently?

I want to hear about any absolute GEMS (ruby devs need not smirk) from your package manager libraries.

Today, I found THESE! (not just one!)

Randexp

GitHub logo fent / randexp.js

Create random strings that match a given regular expression.

randexp.js

randexp will generate a random string that matches a given RegExp Javascript object.

Dependency Status codecov

Usage

const RandExp = require('randexp');
// supports grouping and piping
new RandExp(/hello+ (world|to you)/).gen();
// => hellooooooooooooooooooo world

// sets and ranges and references
new RandExp(/<([a-z]\w{0,20})>foo<\1>/).gen();
// => <m5xhdg>foo<m5xhdg>

// wildcard
new RandExp(/random stuff: .+/).gen();
// => random stuff: l3m;Hf9XYbI [YPaxV>U*4-_F!WXQh9>;rH3i l!8.zoh?[utt1OWFQrE ^~8zEQm]~tK

// ignore case
new RandExp(/xxx xt

Enter fullscreen mode Exit fullscreen mode

View on GitHub

I’m writing a Slack bot that reacts to a word in a message. It listens for a message and matches it with a regex, responding appropriately.

This library will allow me to write tests that match, without hard coding a message.

Ngrok

GitHub logo bubenshchykov / ngrok

Expose your localhost to the web. Node wrapper for ngrok.

ngrok Tests TypeScript compatible npm npm

This project is the Node.js wrapper for the ngrok client. Version 5 of this project uses ngrok client version 3. For ngrok client version 2, check out version 4.

alt ngrok.com

Usage

Local install

Install the package with npm:

npm install ngrok

Enter fullscreen mode Exit fullscreen mode

Then use ngrok.connect() to start ngrok and open a tunnel.

const ngrok = require('ngrok');
(async function() {
  const url = await ngrok.connect();
})();

Enter fullscreen mode Exit fullscreen mode

This module uses node>=10.19.0 with async/await. For a callback-based…

View on GitHub

Ngrok’s npm package can be run as a module! I was so amazed I wrote it up as a little hello-world guide this morning.

The Ultimate npm run dev

lukeocodes profile

@lukeocodes 🕹👨‍💻

@lukeocodes 🕹👨‍💻

@lukeocodes 🕹👨‍💻

Follow

Apr 23 ’20

The Ultimate npm run dev

#showdev #node #javascript #opensource

78 reactions Comments 4 comments

2 min read

So did you stumble upon any neat code this week?