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

wildling

v0.1.18

Published

Wildling string generator library

Downloads

34

Readme

Wildling wildcard

String generator library. This is a library for creating patterns from strings with wildcard tokens which can then be used for various purposes.

Build Status NPM

Contributing

Please create issues or open pull requests if you find something wrong or feel like contributing to this project.

Introduction

{{examples/usage.js}} This example will write the following words to console.log:

abrakadabra
foo0
foo1
foo2
foo3
foo4
foo5
foo6
foo7
foo8
foo9

In a browser

{{examples/index.html}} This example will write the following lines in the browser body:

foo0
foo1
foo2
foo3
foo4
foo5
foo6
foo7
foo8
foo9

Installation

via npm

npm install wildling

Tests

Wildling is using Ava for testing and nyc for test coverage. To test run:

npm test

Why?

In the example above it would be rather pointless to use Wildling but for more complex patterns like when you are trying to find a domain name for a project named clams(Assuming all good tlds for this is taken) then we could use wildling to create a script to check whois records like this:

  1. write simple script for checking if a domain name is free
  2. import wildling into it
  3. specify a dictionary called tld with com, net and org
  4. use built-in dictionary called colors
  5. use a pattern like this
%{'colors',0-1}clams%{'colors',0-1}#{0-2}.%{'tld'}
  1. and let the script run We would then find out that fx. clams9.com and blueclamsred87.org are free and all the others are taken(unlikely I know :) ).

Escaping charaters to avoid pattern creation

{{examples/escaping.js}}

Wildling parameters

{{examples/parameters.js}} In simple wildcards the format is

<wildcard character>[{<startLength>[-endLength]}]

Meaning these would all be valid patterns:

#
#{2}
#{2-4}

In the special wildcards the format is

<wildcard character>{'<settings>'[,<startLength>[-endLength]]}

Meaning these would all be valid patterns:

${'test,dummy'}
${'test,dummy',2}
${'test,dummy',2-4}

The simple wildcards

# Numbers 0-9

{{examples/numbers.js}}

@ Lowercase letters a-z

{{examples/lowercase.js}}

* Lowercase letters a-z and numbers 0-9

{{examples/lowerAndNumbers.js}}

& Lower and uppercase letters a-zA-Z

{{examples/lowerAndUpper.js}}

? Uppercase letters A-Z and numbers 0-9

{{examples/upperAndNumbers.js}}

! Uppercase letters A-Z

{{examples/uppercase.js}}

- Lower and uppercase letters a-zA-Z and numbers 0-9

{{examples/lowerAndUpperAndNumbers.js}}

The special wildcards

$ Words and special characters

{{examples/words.js}}

% Dictionaries

{{examples/dictionaries.js}} Wildling also has some built-in libraries which are:

  • colors
  • planets
  • passwords But these are mainly for demo, test and example purposes

License

MIT, see LICENSE file