open-index/open-npm huggingface dataset:
npm package: @fasteroid/maps
Description: Some extensions and variations of Map<K, V>
Author: Fasteroid
Latest version: 3.0.0

# @fasteroid/maps

A few variations of the vanilla `Map<K, V>` that might make your life easier.

## Classes

### `AutoMap<K, V>`
Populates empty keys when getting them, based on a function that receives the key in question.

> ##### 💡⠀This package also provides "auto" variants for most of the classes below!

### `CollisionMap<K, V>`
You tell it how to hash keys into primitives. &nbsp;Has two interesting use-cases:
- Indexing by unordered pairs—if you want `[1, 2]` and `[2, 1]` to point at the same thing
- Indexing by objects that *feel* primitive but aren't—eg. regexes

> ##### ⚠️⠀DON'T use `JSON.stringify` for your hash function. &nbsp;Hash functions need to be fast.

### `SemiWeakMap<K, V>`
Like a native [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap), but you can store primitives on it.

### `WeakPairing<K, V>`
Like a [`SemiWeakMap`](#semiweakmapk-v), but the values are also weakly held. &nbsp;Useful as a weak bidirectional lookup table.\
Values referenced by a pair can be garbage-collected as long as *at least* one of them is garbage-collectable.

### `Ordering<T>`
Stores the concept of an enumerable "order" for any set of values.\
Has one method, `apply(values: T[])`, which sorts the values into an unspecified but consistent ordering within the scope of the ordering's lifetime.
> ##### ⚠️⠀Objects are sorted by reference, not contents. &nbsp;Don't assume the same order between program executions.

### `TagMap<K, V>`
Indexes items by unordered collections of keys rather than traditional single keys.

## License

MIT License
npm package: @fasteroid/panzoom-revamped
Description: Extensible, mobile friendly pan and zoom framework.
Author: Fasteroid
Latest version: 11.0.0

# @fasteroid/panzoom-revamped
###### based on [anvaka's panzoom](https://github.com/anvaka/panzoom)

*Actually* extensible, mobile-friendly pan & zoom framework.<br>
Now with 20% less jank!

## Usage Example
```html
<style>
    .flexbox-centerer {
        box-sizing: border-box;
        overflow: hidden;

        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>

<div class="flexbox-centerer">
    <img id="cat" src="https://cataas.com/cat">
</div>

<script type="module">
    import { Panzoom } from "../dist/index.js"; // or however else you'd import in your environment
    let pz = new Panzoom( document.getElementById("cat") );
</script>
```

## But what if..?
###### Is this the right one for me?
- Yes, this is one of the \*good\* libraries like [anvaka's](https://github.com/anvaka/panzoom) that factor touch and cursor locations into zooming.

- It'll probably work in your favorite framework out-of-the-box since it uses ✨ *no dependencies!* ✨<br>
*Just make sure to call `pz.dispose()` when you're done with one if being used with a framework!*

- It also offers kinetic behavior (on by default) to mimic the smooth scrolling mobile devices tend to implement.<br>
  If the default is too slidey for you, `pz.kinetic.friction` can be changed to fit your needs.

- If you need to know when the panzoom updates its transform, `pz.onTransformChanged(callback)` allows you to attach event handlers.<br>
  This method returns an [`Unsubscribable`](https://rxjs.dev/api/index/interface/Unsubscribable), which you can call `.unsubscribe()` on to remove the event handler.

- Unlike anvaka's library, transforms here are designed to best fit a centered element inside the panzoom's container.<br>
  This may or may not make the math easier when doing external calculations (but it did for me!)

## Limitations...
###### Stuff I can't fix because browsers suck
- Currently, any descendant of a panzoom that creates a new [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Stacking_context) is prone to polluting the entire panzoom with [low-quality zooming](https://www.youtube.com/watch?v=ZrA5hD-XRgk). &nbsp;**This happens consistently on iOS Safari and its [derivatives](https://en.wikipedia.org/wiki/WebKit?useskin=vector), and due to their implementation, even scrollable elements inside the panzoom will trigger this bug.**
## License

MIT License
npm package: @fasteroid/partial-pattern-tree
Description: Not quite partial regex matching, but pretty darn close!
Author: Fasteroid
Latest version: 2.0.2

# @fasteroid/partial-pattern-tree

*&ldquo;Not quite partial regex matching, but pretty darn close!&rdquo;*<br>

## Premise
Say you want to assign "names" to a series of values and then search for them.

The "best" result—since users are creative and unpredictable—is to look for partial matches. &nbsp;This is really easy if your "names" are just unchanging string literals (just see if they contain the search query), but becomes an absolute head-scratcher when you decide you want to name your list entry `Order ID\d+` where `\d+` is *any* sequence of digits.

And no, you *can't* just naively regex this either, because doing that forfeits partial matching. &nbsp;"Order" (or just "der" if your user is a lunatic) doesn't match `Order ID\d+`, so the option won't show up 😭

So are you just cooked, or is there a way? &nbsp;Fear not, as this package (kind of) solves your problem!

## Usage
```ts
import { PartialPatternTree } from "@fasteroid/partial-pattern-tree"

type Pet = {
  importance: string,
  name: string
}

const tree = new PartialPatternTree<Pet>(
    [
        ["parake", /^e+/m, "t"], // this "name" matches parakeet, parakeeet, parakeeeee... you get the idea.
        {
            name: "Newton"
            importance: "actually ate my homework once (not kidding)"
        }
    ],
    [
        ["parrot"], // this name just looks for "parrot"
        {
            name: "Polly"
            importance: "has a crippling cracker addiction"
        }
    ]
)

tree.search("keeeeeeeeeee"); // returns an array containing Newton
```

## But what if..?
- Q: I want to order the search results based on relevance and I want it to not be complete garbage!
  - A: First of all that's not a question—but yes it does do that. &nbsp;The metric I chose is "how many characters into the name must we skip to find the search query?"
- Q: This is literally just a generalized suffix tree with extra steps!
  - Also not a question. &nbsp;But good observation!
- Q: If this is a suffix tree why aren't you constructing it with Ukkonen's algorithm?
  - A: I'm an idiot 🤡 &nbsp;<br>...but if you know how, I'd love if you [made a pull request](https://github.com/Fasteroid/partial-pattern-tree/pulls)!
- Q: Why is this README so GOOFY?
  - A: To make you smile!  Duh!!!

## License

MIT License