# staack

> A library to create type-safe opaque stacks

Latest version **3.0.2** (published 2023-06-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install staack
pnpm add staack
yarn add staack
bun add staack
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-06-21 |
| First published | 2023-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 23 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Etienne Dldc |
| Maintainers | etienne-dldc |
| Keywords | stack, typescript |

## Links

- npm: https://www.npmjs.com/package/staack
- Repository: https://github.com/etienne-dldc/staack
- Homepage: https://github.com/etienne-dldc/staack#readme
- Issues: https://github.com/etienne-dldc/staack/issues
- npm.io page: https://npm.io/package/staack

## Dependencies (2)

- [vitest](https://npm.io/package/vitest.md) ^0.32.0
- [@vitest/coverage-v8](https://npm.io/package/@vitest/coverage-v8.md) ^0.32.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2023-06-21
- 3.0.1 — 2023-06-20
- 3.0.0 — 2023-06-20
- 2.0.2 — 2023-06-20
- 2.0.1 — 2023-06-14
- 2.0.0 — 2023-06-14
- 1.0.9 — 2023-06-13
- 1.0.8 — 2023-06-12
- 1.0.7 — 2023-06-11
- 1.0.6 — 2023-06-10
- 1.0.5 — 2023-06-10
- 1.0.4 — 2023-06-10
- 1.0.3 — 2023-06-10
- 1.0.2 — 2023-06-10
- 1.0.1 — 2023-06-10
- … 1 more at https://npm.io/package/staack/versions

## README

# 🏯 Staack

> A library to create type-safe opaque stacks

## Example

```ts
// 1. Create a key with a name and a type
const NumKey = Key.create<number>('Num');

// 2. Create a stack
const stack = new Staack();

// 3. Add a value to the stack using the key (Staack is immutable, it returns a new instance)
const stack2 = stack.with(NumKey.Provider(42));

// 4. Get the value from the stack using the key
expect(stack2.get(NumKey.Consumer)).toBe(42);
```

## Installation

```bash
npm install staack
# or
yarn add staack
```

## Extending `Staack`

You can create your own `Staack`:

```ts
class CustomStaack extends Staack {
  // You need to override the `instantiate` method to return a new instance of your CustomStack
  protected instantiate(staackCore: StaackCoreValue): this {
    return new CustomStaack(staackCore) as any;
  }
}

const custom = new CustomStaack();
expect(custom instanceof CustomStaack).toBe(true);
expect(custom instanceof Staack).toBe(true);
```

---
_Source: https://npm.io/package/staack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
