open-index/open-npm huggingface dataset:
npm package: @skorotkiewicz/rmatch
Description: A utility function inspired by Rust's match for pattern matching in JavaScript/TypeScript.
Author: Sebastian Korotkiewicz
Latest version: 1.0.2

# rMatch

A utility function inspired by Rust's match for pattern matching in JavaScript/TypeScript.

## Installation

```bash
npm install @skorotkiewicz/rmatch
# or
yarn add @skorotkiewicz/rmatch
```

## Usage

```js
// const { match } = require("@skorotkiewicz/rmatch");
import { rmatch } from "@skorotkiewicz/rmatch";

// Example usage:
let age = 8;
rmatch(age, [
  [(val) => val >= 1 && val <= 18, () => console.log("Important Birthday")],
  [(val) => val === 21 || val === 50, () => console.log("Important Birthday")],
  [
    (val) => val >= 65 && val <= Number.MAX_SAFE_INTEGER,
    () => console.log("Important Birthday"),
  ],
  [() => true, () => console.log("Not an Important Birthday")], // Default
]);
```

## API

`rmatch(value, patterns)`

- `value`: The value to be matched against patterns.
- `patterns`: An array of patterns, where each pattern is a tuple of two elements:
  - The first function checks if the value matches the pattern.
  - The second function executes when a match is found.

## License

This project is licensed under the MIT License.
npm package: @skorotkiewicz/snowflake-id
Description: Snowflake ID is a unique identifier commonly used in distributed systems to generate unique IDs with a timestamp component. It is designed to ensure uniqueness, even in distributed and highly concurrent environments.
Author: Sebastian Korotkiewicz
Latest version: 1.0.1

# @skorotkiewicz/snowflake-id

> Snowflake ID is a unique identifier commonly used in distributed systems to generate unique IDs with a timestamp component. It is designed to ensure uniqueness, even in distributed and highly concurrent environments.

The Snowflake ID typically consists of three components:

1. **Timestamp:** Representing the time when the ID was generated.
2. **Machine ID:** Identifying the machine or node that generated the ID.
3. **Sequence Number:** Ensuring uniqueness in cases of multiple IDs generated within the same millisecond.

By combining these components, Snowflake IDs provide a reliable way to generate globally unique identifiers, making them valuable for applications such as distributed databases, messaging systems, and more.

## Install

```
yarn add @skorotkiewicz/snowflake-id
or
npm i @skorotkiewicz/snowflake-id
```

## Usage

```js
import { Snowflake, decodeSnowflake } from "@skorotkiewicz/snowflake-id";

(async () => {
  const machineId = 1; // machine ID (0-1023)
  const snowflake = new Snowflake(machineId);

  const id1 = await snowflake.generate();
  console.log("encodeID", id1);
  // output: 7160521316708126720

  const decoded = decodeSnowflake(id1);
  console.log("decodeID", decoded);
  // output: { timestamp: '2024-02-06T05:12:47.730Z', machineId: '1', sequence: '0' }
})();
```
npm package: @skorpland/auth-js
Description: Official client library for Powerbase Auth
Author: Powerbase
Latest version: 2.71.5

# `auth-js`

An isomorphic JavaScript client library for the [Powerbase Auth](https://github.com/skorpland/auth) API.

## Docs

- Using `auth-js`: https://powerbase.club/docs/reference/javascript/auth-signup
- TypeDoc: https://skorpland.github.io/auth-js/v2

## Quick start

Install

```bash
npm install --save @skorpland/auth-js
```

Usage

```js
import { AuthClient } from '@skorpland/auth-js'

const GOTRUE_URL = 'http://localhost:9999'

const auth = new AuthClient({ url: GOTRUE_URL })
```

- `signUp()`: https://powerbase.club/docs/reference/javascript/auth-signup
- `signIn()`: https://powerbase.club/docs/reference/javascript/auth-signin
- `signOut()`: https://powerbase.club/docs/reference/javascript/auth-signout

### Custom `fetch` implementation

`auth-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:

```js
import { AuthClient } from '@skorpland/auth-js'

const AUTH_URL = 'http://localhost:9999'

const auth = new AuthClient({ url: AUTH_URL, fetch: fetch })
```

## Sponsors

We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves.

[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/skorpland)

![Watch this repo](https://gitcdn.xyz/repo/powerbase/monorepo/master/web/static/watch-repo.gif 'Watch this repo')
npm package: @skorpland/functions-js
Description: JS Client library to interact with Powerbase Functions.
Author: Powerbase
Latest version: 2.5.0

# `functions-js`

[![Coverage Status](https://coveralls.io/repos/github/powerbase/functions-js/badge.svg?branch=main)](https://coveralls.io/github/powerbase/functions-js?branch=main)

JS Client library to interact with Powerbase Functions.

## Docs

<https://powerbase.club/docs/reference/javascript/functions-invoke>

## testing

To run tests you will need Node 20+.

You are going to need docker daemon running to execute tests.

To start test run use the following command:

```sh
npm i
npm run test
```
npm package: @skorpland/postgrest-js
Description: Isomorphic PostgREST client
Author: Powerbase
Latest version: 1.19.8

# `postgrest-js`

[![Build](https://github.com/skorpland/postgrest-js/workflows/CI/badge.svg)](https://github.com/skorpland/postgrest-js/actions?query=branch%3Amaster)
[![Package](https://img.shields.io/npm/v/@skorpland/postgrest-js)](https://www.npmjs.com/package/@skorpland/postgrest-js)
[![License: MIT](https://img.shields.io/npm/l/@skorpland/postgrest-js)](#license)

Isomorphic JavaScript client for [PostgREST](https://postgrest.org). The goal of this library is to make an "ORM-like" restful interface.

Full documentation can be found [here](https://skorpland.github.io/postgrest-js/v2).

### Quick start

Install

```bash
npm install @skorpland/postgrest-js
```

Usage

```js
import { PostgrestClient } from '@skorpland/postgrest-js'

const REST_URL = 'http://localhost:3000'
const postgrest = new PostgrestClient(REST_URL)
```

- select(): https://powerbase.club/docs/reference/javascript/select
- insert(): https://powerbase.club/docs/reference/javascript/insert
- update(): https://powerbase.club/docs/reference/javascript/update
- delete(): https://powerbase.club/docs/reference/javascript/delete

#### Custom `fetch` implementation

`postgrest-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:

```js
import { PostgrestClient } from '@skorpland/postgrest-js'

const REST_URL = 'http://localhost:3000'
const postgrest = new PostgrestClient(REST_URL, {
  fetch: (...args) => fetch(...args),
})
```

## License

This repo is licensed under MIT License.

## Sponsors

We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.

[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/skorpland)