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

larp

v1.0.1

Published

Lightweight Asynchronous Regex Project

Downloads

4

Readme

LARP

Lightweight Asynchronous Regex Project

LARP is a library that uses stored regex patterns and returns the pattern matches in a promise. You can also use URLs or filenames as the argument with an options parameter and LARP will parse the source code of the page or text from the file as arguments for the regex marching. More powerful regex magic than a level 15 spell caster!

Usage

Install

npm install larp

Modules

Import: import * as larp from "./larp";
Require: const larp = require("larp");

Matching

  • Email Addresses
  • URLS
    • url(arg: string, options?: config)
    • Example match: http://www.example.com
  • IPv4 Addresses
    • ipv4(arg: string, options?: config)
    • Example match: 127.0.0.1
  • HTML src Attribute Values
    • src(arg: string, options?: config)
    • Example match: ~~src="~~ /javascripts/main.js ~~">~~
  • HTML href Attribute Values
    • href(arg: string, options?: config)
    • Example match: ~~href="~~ /examples" ~~>~~

Config (optional)

  • url
    • { url: true }
    • Use argument as URL location and URL source will be matched.
  • file
    • { file: true }
    • Use argument as file location and file text will be matched.

Examples (basic)

The string argument specifies the text to be matched.

larp.email("Lorem ipsum [email protected] dolor sit amet.");
    => Promise: [ '[email protected]' ]

larp.url("Lorem ipsum https://www.example.com dolor sit amet.");
    => Promise: [ 'https://www.example.com' ]

larp.ipv4("Lorem ipsum 127.0.0.1 dolor sit amet.");
    => Promise: [ '127.0.0.1' ]

larp.src("<h1>Lorem ipsum</h1><img src="unicorn.png"><h1>dolor sit amet.</h1>");
    => Promise: [ 'unicorn.png' ]

larp.href("<h1>Lorem ipsum</h1><a href="/unicorns.html">Unicorns</a><h1>dolor sit amet.</h1>");
    => Promise: [ '/unicorns.html' ]

Examples (options)

The string argument specifies the filename when option { file: true } is provided:

larp.ipv4("sample.txt", { file: true })
	=> Promise: [ '127.0.0.1' ]

The string argument specifies the URL location when option { url : true } is provided:

larp.href("http://www.example.com", { url: true })
	=> Promise: [ '/stylesheets/style.css', '/examples' ]

Attribution