spirits
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

spirits

Get the spirit of a string, without the whole thing!

A glob/wildcard matching library.

I know there are already a lot of these, but I had a use case that required testing a string against many wildcards and determining which matched most specifically. I couldn't find one that did that, so I just made my own. (If you would like that same functionality, look for the bestMatch function.)

Usage

import Spirit from "spirits";

const format = new Spirit("The weather is * today!");
const greeting = "The weather is great today!";

console.log(
	format.match(greeting)
		? greeting
		: "I have no idea what the weather is like because I am just a computer!",
);

Readme

Keywords

none

Package Sidebar

Install

npm i spirits

Weekly Downloads

1

Version

3.0.0

License

MPL-2.0

Unpacked Size

61.6 kB

Total Files

13

Last publish

Collaborators

  • partheseas