open-index/open-npm huggingface dataset:
npm package: @lucaszanek/platzom
Description: Traductor de idioma platzom
Author: Lucas Zanek
Latest version: 0.1.0

# Platzom

Platzom es un idioma inventado para [mi](https://www.twitter.com/lucaszanek96)aprendizaje en pl...

## Descripción del idioma

- Si la palabra termina con "ar", se le quitan esas dos letras
- Si la palabra inicia con Z, se le añade "pe" al final
- Si la palabra traducida tiene 10 o más letras, se debe partir en dos por la mitad y unir con un guión medio
- Por último, si la palabra original es un palíndromo, ninguna regla anterior cuenta y se devuelve la misma palabra pero intercalando letras mayúsculas y minúsculas

## Instalación

```
npm install platzom
```

## Uso

```
import platzom from 'platzom'

platzom("Programar") // Program
platzom("Zorro") // Zorrope
platzom("Zarpar") // Zarppe
platzom("abecedario") // abece-dario
platzom("sometemos") // SoMeTeMoS
```

## Créditos
- [LucasZanek](https://twitter.com/lucaszanek96)

## Licencia

[MIT](https://opensource.org/licenses/MIT)
npm package: @lucatolton/text-manipulation
Description: Change the way that text looks with a simple NPM package
Latest version: 1.0.1

# @lucatolton/text-manipulation

[![npm(scoped)](https://img.shields.io/npm/v/@lucatolton/text-manipulation)](https://github.com/lucatolton/text-manipulation)
[![npm bundle size(minified)](https://img.shields.io/bundlephobia/min/@lucatolton/text-manipulation)](https://github.com/lucatolton/text-manipulation)

Change the way that text looks using a simple NPM package
npm package: @lucatolton/tiny
Description: Removes all spaces from a string
Latest version: 1.0.0

# @lucatolton/tiny

[![npm(scoped)](https://img.shields.io/npm/v/@lucatolton/tiny)](https://github.com/lucatolton/tiny)
[![npm bundle size(minified)](https://img.shields.io/bundlephobia/min/@lucatolton/tiny)](https://github.com/lucatolton/tiny)

It's the tiniest!
npm package: @lucca-ui/ng
Description: * Checkout * Go to the `ng2` folder * Install dependancies :    ```    $ npm install    ``` * You will need a copy of `lucca-icons` in `node_modules` (the folder in `ng2`)    * Use bower or download it from Github * Build `ng2-select` :    * Go t
Latest version: 4.0.0-alpha.1

## Prerequisites
* Checkout
* Go to the `ng2` folder
* Install dependancies :
   ```
   $ npm install
   ```
* You will need a copy of `lucca-icons` in `node_modules` (the folder in `ng2`)
   * Use bower or download it from Github
* Build `ng2-select` :
   * Go to `ng2/node_modules/ng2-select`
   * Install node dependancies :
   ```
   $ npm install
   ```
   * Install typings :
   ```
   $ typings install
   ```
* Create LUI Website on IIS :
   * Binding : `localhost` on port `8080`
   * Source : `<lucca-ui path>/ng2/demo_dist`

## Src & dev workspace for lucca ui ng2 migration

- Write your sources and specs inside /src.
- Plug your component in /demo app, to see it live.

### To develop:
```
$ npm run watch
```
Then go to `http://localhost:8080/`.
### To test:
```
$ npm test
```

All other commands are visible inside the packages.json.
npm package: @luccaallen/chatbot-widget
Description: Customizable chatbot widget for websites - Easy to integrate, works with any backend
Author: Lucca Allen
Latest version: 1.2.0

# @luccaallen/chatbot-widget

A customizable chatbot widget for websites. Easy to integrate, works with any backend.

## Installation

```bash
npm install @luccaallen/chatbot-widget
```

## Usage

### Via CDN (Recommended)

```html
<!-- Include CSS -->
<link href="https://cdn.jsdelivr.net/npm/@luccaallen/chatbot-widget/dist/style.css" rel="stylesheet" />

<!-- Include JavaScript -->
<script type="module">
  import { createChat } from 'https://cdn.jsdelivr.net/npm/@luccaallen/chatbot-widget/dist/chatbot-widget.bundle.es.js';

  createChat({
    webhookUrl: 'YOUR_WEBHOOK_URL',
    title: 'Chat Support',
    welcomeMessage: 'Hello! How can I help you today?'
  });
</script>
```

### Or via script tag

```html
<link href="https://cdn.jsdelivr.net/npm/@luccaallen/chatbot-widget/dist/style.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/@luccaallen/chatbot-widget/dist/chatbot-widget.bundle.js"></script>
<script>
  ChatbotWidget.init({
    webhookUrl: 'YOUR_WEBHOOK_URL',
    title: 'Chat Support'
  });
</script>
```

### Via npm

```javascript
import '@luccaallen/chatbot-widget/style.css';
import { createChat } from '@luccaallen/chatbot-widget';

createChat({
  webhookUrl: 'YOUR_WEBHOOK_URL',
  title: 'Chat Support'
});
```

## Configuration

See [GitHub Repository](https://github.com/luccaallen1/quick-chat-webflow-bot-44) for full documentation.

## License

MIT
npm package: @luccamenezes/chatbot
Description: Assistente Digital para integração em qualquer projeto.
Author: luccamenezes
Latest version: 0.1.21

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default tseslint.config([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      ...tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      ...tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      ...tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default tseslint.config([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs['recommended-typescript'],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```
npm package: @luccasoli/example
Description: log messages
Latest version: 1.0.0

# @luccasoli/example

![npm (scoped)](https://img.shields.io/npm/v/@luccasoli/example)
![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/min/@luccasoli/example/0.0.1?label=minified-size)

It log strings to the console.

## Install

```
$ yarn add @luccasoli/example
```

## Usage

```js
const log = require("@luccasoli/example");

log("So much space!");
//=> "So much space!"

log(1337);
//=> "1337"
```
npm package: @luccasr73/with-rn-image-crop-picker
Description: An Expo config plugin for painless setup of `react-native-image-crop-picker`
Author: Luccas Robert
Latest version: 0.1.5

# with-rn-image-crop-picker

Expo config plugin for [react-native-image-crop-picker](https://github.com/ivpusic/react-native-image-crop-picker).

## Why a fork?

The [original package](https://github.com/mwegener-com/with-rn-image-crop-picker) appears to no longer be actively maintained, so I forked it to make small updates and support new expo versions

## About

This plugin adds the required attributes to the specific files as mentioned in the [docs.](https://github.com/ivpusic/react-native-image-crop-picker#step-3)

### iOS

InfoPlist:

- `NSPhotoLibraryUsageDescription`
- `NSCameraUsageDescription`
- `NSMicrophoneUsageDescription`

### Android

AndroidManifest: `<uses-permission android:name="android.permission.CAMERA"/>`

App build.gradle `vectorDrawables.useSupportLibrary = true`

## Important note

Currently there is no full support for front-camera on android.

## Supported expo version

| expo version | plugin version |
| ------------ | -------------- |
| 50.x.x       | 0.1.4          |
| 51.x.x       | 0.1.5          |

## Usage

1. Install with Expo

```sh
expo install @luccasr73/with-rn-image-crop-picker
```

2. Check your app.json. It should look like this:

```json
 "plugins": [
      "@luccasr73/with-rn-image-crop-picker"
    ],
```

3. Run prebuild

```sh
expo prebuild
expo run:ios --device
expo run:android --device
```

## Configuration

You can configure the iOS messages by adding the following props to your app.json file:

- PhotoLibraryUsageDescription
- CameraUsageDescription
- MicrophoneUsageDescription

Example:

```json
"plugins": [
  [
  "@luccasr73/with-rn-image-crop-picker",
  {
   "PhotoLibraryUsageDescription": "Allow app XYZ to access your photos",
   "CameraUsageDescription": "Allow app XYZ to access your camera",
   "MicrophoneUsageDescription": "Allow app XYZ to access your microphone"
  }
 ]
]
```

## Contributing

Contributions are very welcome!
npm package: @lucenthq/sdk
Description: Lucent session replay SDK — record, capture, and analyze user sessions
Author: Lucent
Latest version: 0.0.3

# @lucenthq/sdk

Session replay SDK for Lucent — record, capture, and analyze user sessions with rrweb.

## Installation

```bash
npm install @lucenthq/sdk
```

## Quick Start

```typescript
import { LucentTracker } from "@lucenthq/sdk";

const tracker = new LucentTracker({
  publicKey: "luc_pk_...",
  ingestBaseUrl: "https://your-api.example.com",
});

tracker.start();
```

## React / Next.js

```tsx
import { LucentProvider, LucentIdentify } from "@lucenthq/sdk/react";

function App({ children }) {
  return (
    <LucentProvider publicKey="luc_pk_..." options={{ ingestBaseUrl: "https://your-api.example.com" }}>
      <LucentIdentify userId={user?.id} email={user?.email} />
      {children}
    </LucentProvider>
  );
}
```

## Configuration

```typescript
new LucentTracker({
  publicKey: "luc_pk_...",
  ingestBaseUrl: "https://your-api.example.com",
  capture: {
    console: true,           // Capture console.log/warn/error
    network: true,           // Capture fetch/XHR requests
    clicks: true,            // Default
    inputs: true,            // Default
    canvas: false,           // Default
  },
  privacy: {
    mode: "privacy-first",   // Mask all text by default
  },
  detection: {
    rageClickThreshold: 3,   // Default: 3 clicks in 1s
    deadClickTimeoutMs: 500, // Default: 500ms no mutation
  },
  sampling: {
    sessionReplay: 1.0,      // 0.0 - 1.0
  },
});
```

## API

### LucentTracker

- `start()` — Begin recording
- `stop()` — Stop recording and flush
- `identify(user)` — Identify the current user
- `resetIdentity()` — Clear user identity
- `track(name, properties?)` — Track a custom event
- `flush()` — Manually flush the event queue
- `getSessionInfo()` — Get current session/window IDs

### React

- `<LucentProvider>` — Initialize and manage the tracker lifecycle
- `<LucentIdentify>` — Sync user identity with the tracker
- `useLucent()` — Access the tracker instance from context
npm package: @luceo-sports/nodebb-plugin-assign-newuser-to-group
Description: A plugin for NodeBB to assign new users to a specified group.
Author: Pichalite
Latest version: 0.3.2

# NodeBB assign new user to group

This NodeBB plugin assigns new users to a group set under plugin settings. 

To set the group, please consult the "Assign new user to group" page in the administration panel, under the "Installed Plugins" heading.

##Installation

    * Install this plugin using the "Plugins" page in NodeBB ACP
    * Set the group in the plugin settings page in ACP
    * Restart NodeBB
npm package: @luceo-sports/nodebb-plugin-sso-oauth
Description: NodeBB Generic OAuth SSO Via LuceoSports
Author: Alexei Boyko
Latest version: 0.6.0

# NodeBB OAuth SSO

NodeBB Plugin that allows users to login/register via any configured OAuth provider. **Please note** that this is not a complete plugin, but merely a skeleton with which you can create your own OAuth SSO plugin for NodeBB (and hopefully share it with others!)

## How to Adapt

1. Fork this plugin
    * ![](http://i.imgur.com/APWHJsa.png)
1. Add the OAuth credentials (around line 30 of `library.js`)
1. Update profile information (around line 137 of `library.js`) with information from the user API call
1. Activate this plugin from the plugins page
1. Restart your NodeBB
1. Let NodeBB take care of the rest

## Trouble?

The NodeBB team builds out SSO plugins for a nominal fee. [Reach out to us for a quote.](mailto:sales@nodebb.org)

Find us on [the community forums](http://community.nodebb.org)!
npm package: @luceosports/nodebb-plugin-assign-newuser-to-group
Description: A plugin for NodeBB to assign new users to a specified group.
Author: Pichalite
Latest version: 0.3.3

# NodeBB assign new user to group

This NodeBB plugin assigns new users to a group set under plugin settings. 

To set the group, please consult the "Assign new user to group" page in the administration panel, under the "Installed Plugins" heading.

##Installation

    * Install this plugin using the "Plugins" page in NodeBB ACP
    * Set the group in the plugin settings page in ACP
    * Restart NodeBB
npm package: @luceosports/nodebb-plugin-iframely
Description: Iframely will give you embeds from over 1700 domains, plus previews for the rest of the web.
Author: Julian Lam
Latest version: 0.8.1

# Iframely for NodeBB

Iframely will give you embeds from over 1700 domains, plus previews for the rest of the web. Powered by remote API. 

Here's how it looks:

![Screenshot](./screenshot.png)

Try your URLs at [iframely.com/debug](http://iframely.com/debug) to see how it is supported.

## Features

 * YouTube, Vimeo, SoundCloud, Gists, Twitter, Facebook, Instagrams, Google Maps, Imgur, Giphy, GfyCat, Flickr - you name it. Plus, articles and general links. 
 * URL previews automatically collapse if post gets downvoted a lot.
 * Embed codes will be responsive and will look great on any device.
 * You can use it with API key via [cloud service](https://iframely.com), or self-host the [open-source version](https://github.com/itteco/iframely)
 * Optionally use [Camo Image Proxy](https://github.com/atmos/camo) to avoid image hot-linking and mixed-content warnings in SSL.


## Contribute

PRs are welcome. 

If you see a problem - please submit an issue. 

The plugin is maintained by joint effort of Iframely and NodeBB.
npm package: @luceosports/nodebb-plugin-sso-oauth
Description: NodeBB Generic OAuth SSO Via LuceoSports
Author: Alexei Boyko
Latest version: 0.6.2

# NodeBB OAuth SSO

NodeBB Plugin that allows users to login/register via any configured OAuth provider. **Please note** that this is not a complete plugin, but merely a skeleton with which you can create your own OAuth SSO plugin for NodeBB (and hopefully share it with others!)

## How to Adapt

1. Fork this plugin
    * ![](http://i.imgur.com/APWHJsa.png)
1. Add the OAuth credentials (around line 30 of `library.js`)
1. Update profile information (around line 137 of `library.js`) with information from the user API call
1. Activate this plugin from the plugins page
1. Restart your NodeBB
1. Let NodeBB take care of the rest

## Trouble?

The NodeBB team builds out SSO plugins for a nominal fee. [Reach out to us for a quote.](mailto:sales@nodebb.org)

Find us on [the community forums](http://community.nodebb.org)!
npm package: @lucets/client
Description: Client for @lucets/luce
Author: Michiel van der Velde
Latest version: 0.1.0

# @lucets/client

Browser client for [@lucets/luce](http://github.com/lucets/luce), a
versatile WebSocket framework for node.js.

# Install

```
npm i @lucets/client
```

## Browserify

Use in combination with [Browserify](http://browserify.org/).

## Example

This example shows how to add message hooks and connect
to the server.

```ts
'use strict'

import Application from './index'

const app = new Application()

app.useMessage(async (message, ctx, next) => {
  console.log(`[message]: ${JSON.stringify(message)}`)
  return next()
})

app.connect('ws://localhost:3003').then(ctx => {
  console.log(`[open]: connected to ${ctx.url.toString()}`)

  let interval: any = setInterval(() => {
    ctx.send({ cmd: 'ping' })
  }, 2500)

  app.once('disconnect', () => clearInterval(interval))
}).catch((err: Error) => {
  console.error('error', err)
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/commands
Description: Hook to route message commands in @lucets/luce
Author: Michiel van der Velde
Latest version: 1.0.1

# @lucets/commands

Message hook which allows setting hooks for individual commands.

Designed to be used with [Luce](https://github.com/lucets/luce).

## Install

```
npm i @lucets/commands
```

## Example

```ts
'use strict'

import { Server } from 'http'

import Application, { WebSocketError } from '@lucets/luce'
import Commands from './index'

const { name, version } = require('../package')

const app = new Application()
const commands = new Commands({ key: 'cmd' }) // message key, default 'cmd'
const server = new Server()

// Implement a catch-all hook
commands.use('*', async (message, ctx) => {
  return ctx.send({
    cmd: 'error',
    message: `Unknown command: ${message[commands.key]}`
  })
})

// Implement a ping command
commands.use('ping', async (message, ctx, next) => {
  await ctx.send({ cmd: 'pong' })
})

// Implement a version info command
commands.use('version-info', async (message, ctx, next) => {
  await ctx.send({
    cmd: 'version-info',
    name,
    version
  })
})

// Implement a publish command
commands.use('publish', async (message, ctx, next) => {
  if (!ctx.state.authorized) {
    // 4401 - Unauthorized
    throw new WebSocketError(4401)
  }
  return next()
}, async (message, ctx, next) => {
  if (!message.package) {
    // 4400 - Bad Request
    throw new WebSocketError(4400)
  }
  return next()
}, async (message, _ctx, next) => {
  console.log(`[publish]: now publishing ${message.package}`)
  return next()
})

// Compose the commands hook
// If the commands hook does not handle the message,
// send an error to the client
app.useMessage(commands.compose(), async (message, ctx, next) => {
  await ctx.send({
    cmd: 'error',
    message: `unknown command: ${message[commands.key] ?? 'none'}`
  })
})

// Add the upgrade method to the server
server.on('upgrade', app.onUpgrade())
server.listen(3004, () => {
  console.log('Server listening on port 3004')
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/luce
Description: Versatile framework for WebSockets
Author: Michiel van der Velde
Latest version: 0.4.3

# Luce

Luce is a versatile WebSocket framework for node.js.

It is the spiritual successor to [illustriws](https://github.com/MichielvdVelde/illustriws)
and [signal-fire](https://github.com/MichielvdVelde/signal-fire).

## Features

* Based around asynchronous hooks analogous to middelware in e.g.
[koa](https://github.com/koajs/koa)
* Run hooks before and after the HTTP request upgrades to WebSocket
* Run hooks on each received message

## Install

Install luce through npm:

```
npm i @lucets/luce
```

## Documentation

[Click here to view the documentation](https://lucets.github.io/luce/).

## Example

A very complicated-looking example which demonstrates
key features.

```ts
'use strict'

import { Server } from 'http'

import Application, { DefaultMessage, DefaultState } from './index'
import { nanoid } from 'nanoid/async'

import { NotFound } from 'http-errors'

/** Custom message interface */
export interface MyMessage extends DefaultMessage {
  cmd: string
}

/** Custom state interface */
export interface MyState extends DefaultState {
  id?: string,
  received: number
}

const app = new Application<MyMessage, MyState>()
const server = new Server((req, res) => {
  let statusCode: number
  let message: string

  if (req.url.startsWith('/socket')) {
    statusCode = 426
    message = 'Upgrade Required'
  } else {
    statusCode = 404
    message = 'Not Found'
  }

  res.writeHead(statusCode, message, {
    'Content-Type': 'text/plain',
    'Content-Length': Buffer.byteLength(message)
  })

  res.end(message)
})

// These hooks are run prior to upgrading to WebSocket
app.useUpgrade('pre', async (ctx, next) => {
  // Check if the request path is valid
  if (!ctx.req.url.startsWith('/socket')) {
    throw new NotFound()
  }

  return next()
})

// These hooks are run after upgrading to WebSocket
app.useUpgrade('post', async (ctx, next) => {
  // Generate a client ID if none is set
  if (!ctx.state.id) {
    ctx.state.id = await nanoid()
  }
  return next()
}, async (ctx, next) => {
  // Send welcome message to the client
  await ctx.send({ cmd: 'welcome', id: ctx.state.id })
  return next()
})

// These hooks are run on each received message
app.useMessage(async (message, _ctx, next) => {
  // Log the message to the console
  console.log(`[message]: ${JSON.stringify(message)}`)
  return next()
}, async (_message, ctx, next) => {
  // Count the number of received messages
  ctx.state.received = (ctx.state.received ?? 0) + 1
  return next()
}, async (_message, ctx, next) => {
  // Log the number of received messages to the console
  console.log(`[message]: received: ${ctx.state.received}`)
  return next()
})

server.on('upgrade', app.onUpgrade())
server.listen(3003, () => {
  console.log('Server listening on port 3003')
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/message-hooks
Description: Versatile framework for WebSockets
Author: Michiel van der Velde
Latest version: 0.1.0

# @lucets/message-hooks

..

## Install

Install through npm:

```
npm i @lucets/message-hooks
```

## Example

```ts
'use strict'

import MessageHooks from './index'

// Example message interface
export interface Message {
  n: number
}

// Example context interface
export interface Context {
  state: Record<string, any>
}

const hooks: MessageHooks<Message, Context> = new MessageHooks()

// Add a hook
hooks.add(async (message, ctx, next) => {
  console.log(`[message]: ${JSON.stringify(message)}`)
  return next()
})

// Run all hooks
hooks.run({ n: 1 }, { state: {} }).then(() => {
  console.log('hooks successfully run')
}).catch((err: Error) => {
  console.error(err)
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/redis-registry
Description: Redis registry for @lucets/registry
Author: Michiel van der Velde
Latest version: 0.1.0

# @lucets/redis-registry

Redis registry for [@lucets/registry](https://github.com/lucets/registry).
Allows a decentralized application to send messages to peers on remote
instances using Redis Streams.

## Install

Install through npm:

```
npm i @lucets/redis-registry
```

## Example

See [@lucets/registry](https://github.com/lucets/registry) for more information.

```ts
import IORedis from 'ioredis'
import RedisRegistry from '@lucets/redis-registry'

const connection = new IORedis()
const registry = new RedisRegistry({ connection })

// Example: create a new client
await registry.create('id', {
  url: '/url'
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/registry
Description: Client registry for @lucets/luce
Author: Michiel van der Velde
Latest version: 0.2.0

# @lucets/registry

Register WebSocket clients and manage their info.

The main component is a `Registry` interface which can be implemented
in your own registries.
The accompanying `LocalRegistry` is an in-memory registry which can be
used as a reference implementation.

Developed for use in combination with [@lucets/luce](https://github.com/lucets/luce),
but is in no way dependent on it.

## Install

```
npm i @lucets/registry
```

## Example

An example in combination with luce.

```ts
'use strict'

import Application, { WebSocketError } from '@lucets/luce'
import { LocalRegistry } from '@lucets/registry'
import { nanoid } from 'nanoid/async'

const app = new Application()
const registry = new LocalRegistry()

// Set an ID
// Set a flag to delete the peer from the
// registry once the connection has closed
app.useUpgrade('pre', async (ctx, next) => {
  ctx.state.id = await nanoid()
  ctx.state.deleteOnClose = true
  return next()
})

app.useUpgrade('post', async (ctx, next) => {
  // Create the ID if it doesn't exist yet
  if (!await registry.exists(ctx.state.id)) {
    await registry.create(ctx.state.id)
  }

  // Register the socket with the registry
  await registry.register(ctx.state.id, ctx.socket)

  ctx.socket.once('close', async () => {
    // Unregister the ID
    await registry.unregister(ctx.state.id)
  
    // Delete the ID if the flag is set
    if (ctx.state.deleteOnClose) {
      await registry.delete(ctx.state.id)
    }
  })

  return next()
})

app.useMessage(async (message, ctx, next) => {
  // Update client info
  if (message.cmd === 'update-info') {
    await registry.update(ctx.state.id, message.info)
  }
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).
npm package: @lucets/upgrade-hooks
Description: Upgrade hooks for @lucets/luce
Author: Michiel van der Velde
Latest version: 0.1.0

# Luce

Upgrade hooks for [@lucets/luce](https://github.com/lucets/luce).

Can be used stand-alone as well. Zero dependencies!

## Install

Install through npm:

```
npm i @lucets/upgrade-hooks
```

## Example

```ts
'use strict'

import UpgradeHooks from './index'

export interface Context {
  [key: string]: any
}

const hooks = new UpgradeHooks<Context>()

// Add a hook
hooks.add(async (ctx, next) => {
  console.log('[upgrade]: incoming request')
})

// Run hooks
const ctx = {}
hooks.run(ctx).then(() => {
  console.log('hooks successfully run')
}).catch((err: Error) => {
  console.error(err)
})
```

## License

Copyright 2021 [Michiel van der Velde](https://michielvdvelde.nl).

This software is licensed under [the MIT License](LICENSE).