Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aslilac/spirits
Get the spirit of a string, without the whole thing!
https://github.com/aslilac/spirits
fuzzy-matching glob wildcard
Last synced: 3 months ago
JSON representation
Get the spirit of a string, without the whole thing!
- Host: GitHub
- URL: https://github.com/aslilac/spirits
- Owner: aslilac
- License: mit
- Created: 2017-12-04T21:30:16.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T04:17:21.000Z (about 2 years ago)
- Last Synced: 2024-10-12T22:40:20.412Z (3 months ago)
- Topics: fuzzy-matching, glob, wildcard
- Language: TypeScript
- Homepage: https://spirits.vercel.app
- Size: 347 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spirits
[![package version](https://img.shields.io/badge/dynamic/json?color=d0d0d0&label=spirits&prefix=v&query=%24%5B%27dist-tags%27%5D.latest&url=https%3A%2F%2Fregistry.npmjs.com%2Fspirits)](https://npmjs.com/package/spirits)
[![main](https://github.com/aslilac/spirits/workflows/main/badge.svg)](https://github.com/aslilac/spirits/actions)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)A nice lightweight wildcard implementation written in TypeScript. I know there are already
a lot of these, but I had a use case that required to test a string against many wildcards
and determine 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 at the `bestMatch`
documentation.)## Usage
- [Documentation](https://spirits.vercel.app)
Example:
```JavaScript
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!");
```