open-index/open-npm huggingface dataset:
npm package: @jameslnewell/jest-preset
Description: A [`jest`](https://jestjs.io/) preset according to my preferences.
Latest version: 4.0.0

# @jameslnewell/jest-preset-node

A [`jest`](https://jestjs.io/) preset according to my preferences.

## Installation

```
npm install --dev jest @types/jest @jameslnewell/jest-preset-node
```

## Usage

Add the following configuration to your `package.json`:

```json
{
  "jest": {
    "preset": "@jameslnewell/jest-preset-node"
  },
  "scripts": {
    "test": "jest --selectProjects unit --passWithNoTests",
    "test:e2e": "jest --selectProjects e2e --passWithNoTests"
  }
}
```

> Create a `.swcrc` file via `@jameslnewell/swc-config` to configure transpilation.
npm package: @jameslnewell/jest-preset-node
Description: A [Jest](https://jestjs.io/) preset according to my preferences.
Latest version: 1.0.1

# @jameslnewell/jest-preset-node

A [Jest](https://jestjs.io/) preset according to my preferences.

## Installation

```
npm install --dev jest @types/jest @jameslnewell/jest-preset-node
```

## Usage

Add the following configuration to your `package.json`:

```json
{
  "jest": {
    "preset": "@jameslnewell/jest-preset-node"
  },
  "scripts": {
    "test": "jest --selectProjects unit", 
    "test:e2e": "jest --selectProjects e2e" 
  }
}
```

> Configure a `.swcrc` to start transpiling code.
npm package: @jameslnewell/jest-preset-test
Description: A test preset for my personal projects that use `jest`.
Latest version: 6.0.0
Deprecated: use

# @jameslnewell/jest-preset-test

A test preset for my personal projects that use `jest`.

## Installation

```
yarn add --dev @babel/core @jameslnewell/jest-preset-test
```

## Usage

`jest.config.js`

```
{
  projects: [
    displayName: 'test',
    preset: '@jameslnewell/jest-preset-test'
  ]
}
```

> Requires a `.babelrc`. See `@jameslnewell/babel-preset`.
npm package: @jameslnewell/logger
Description: A logging library.
Latest version: 3.0.1

# @jameslnewell/logger

[![CircleCI](https://circleci.com/gh/jameslnewell/logger/tree/master.svg?style=svg)](https://circleci.com/gh/jameslnewell/logger/tree/master)

A logging library.

## Installation

```sh
yarn add @jameslnewell/logger
```

## Usage

### Using a logger
```js
import logger from '@jameslnewell/logger';

logger.info('Server is listening on http://localhost:3000');
```

### Using an extended logger
```js
import logger from '@jameslnewell/logger';

const log = logger.extend('my-server');

log.info('Server is listening on http://localhost:3000');
```

### Adding the time to the logs
```js
import logger, {time} from '@jameslnewell/logger';

logger.use(time());
```

### Adding the version to the logs
```js
import logger, {version} from '@jameslnewell/logger';

logger.use(version());
```

### Adding a custom field to the logs
```js
import logger from '@jameslnewell/logger';

logger.use(log => ({...log, foo: 'bar'}));
```

### Filtering the logs
```js
import logger, {Level, filter} from '@jameslnewell/logger';

logger.use(filter(log => log.level === Level.error));
```

### Writing logs to the console
```js
import logger, {ConsoleOutputStream} from '@jameslnewell/logger';

logger.pipe(new ConsoleOutputStream());
```

### Writing logs to a file
```js
import logger, {FileOutputStream} from '@jameslnewell/logger';

logger.pipe(new FileOutputStream());
```

### Writing logs to a file on error
```js
import logger, {MemoryOutputStream} from '@jameslnewell/logger';

const logs = logger.pipe(new MemoryOutputStream());
try {
  // do stuff here
} catch (error) {
  logger.error(error);
  fs.WritingFileSync('app.log', logs);
}
```

### Writing logs to CloudWatch
```js
import logger, {CloudwatchOutputStream} from '@jameslnewell/logger';

logger.pipe(new CloudwatchOutputStream({
  group: 'my-group',
  stream: 'my-stream',
}));
```
npm package: @jameslnewell/observable
Description: A super simple and light-weight observable implementation.
Latest version: 1.5.0

# @jameslnewell/observable

![npm (scoped)](https://img.shields.io/npm/v/@jameslnewell/observable.svg)
[![Bundle Size](https://badgen.net/bundlephobia/minzip/@jameslnewell/observable)](https://bundlephobia.com/result?p=@jameslnewell/observable)
[![Actions Status](https://github.com/jameslnewell/observable/workflows/main/badge.svg)](https://github.com/jameslnewell/observable/actions)

A super simple and light-weight observable implementation.

## Installation

```bash
yarn add @jameslnewell/observable
```

## Usage

```js
const {create, map, pipe} from '@jameslnewell/observable';

const numbers = (ms = 1000) => create(subscriber => {
  let count = 0;
  const handle = setInterval(() => subscriber.next(count++), ms);
  return () => clearInterval(handle);
});

const letters = pipe(map(number => String.fromCharCode(65 + number)))(numbers())

const subscription = letters.subscribe({
  next: data => console.log(data),
  error: error => console.error(error),
  completed: () => console.log('completed')
});

subscription.unsubscribe();

```

## API

### fromArray(array)

### fromError(array)

### create(factory): Observable

### map(fn)(observable): Observable

### delay(ms)(observable): Observable

### pipe(fn1, fn2, fn3)(Observable): Observable

### isObservable(value): boolean

### firstValueFrom(observable: Observable<Value>): Promise<Value>

### lastValueFrom(observable: Observable<Value>): Promise<Value>
npm package: @jameslnewell/prettier-config
Description: A [`prettier`](https://prettier.io/) config according to my preferences.
Latest version: 2.0.0

# @jameslnewell/prettier-config

A [`prettier`](https://prettier.io/) config according to my preferences.

## Installation

```
npm install --dev prettier @jameslnewell/prettier-config
```

## Usage

Add the following configuration to your `package.json`:

```js
{
  "prettier": "@jameslnewell/prettier-config"
}
```
npm package: @jameslnewell/resolve-bin
Description: Resolve the path of a npm package's binary
Author: James Newell
Latest version: 2.1.1

# @jameslnewell/resolve-bin

Resolve the path of a npm package's binary

## Installation

```sh
npm i -S @jameslnewell/resolve-bin
```

## Usage

```js
import resolveBin from "@jameslnewell/resolve-bin";

const path = resolveBin({
  from: __dirname,
  package: 'typescript',
  command: 'tsc',
})
```
npm package: @jameslnewell/rollup-config
Description: Rollup configuration.
Latest version: 1.1.0

# @jameslnewell/rollup-config

Rollup configuration.

## Installation

```
yarn add --dev @jameslnewell/rollup-config
```

## Usage

`@jameslnewell/rollup-config`

```js
/* eslint-env node */
module.exports = require('@jameslnewell/rollup-config');
```
npm package: @jameslnewell/swc-config
Description: Contains a [`swc`](https://swc.rs/) config according to my preferences.
Latest version: 2.0.0

# @jameslnewell/swc-config

Contains a [`swc`](https://swc.rs/) config according to my preferences.

## Installation

NPM:

```bash
npm i -D @jameslnewell/swc-config
cp node_modules/swc-config/.editor-config .swcrc
```
npm package: @jameslnewell/tslint-config
Description: TSLint configuration.
Latest version: 0.1.0

# @jameslnewell/tslint-config

TSLint configuration.

## Installation

```
yarn add --dev @jameslnewell/tslint-config
```

## Usage

`tslint.json`

```json
{
  "extends": "@jameslnewell/tslint-config"
}
```
npm package: @jameslnewell/typescript-config
Description: Contains a [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file according to my preferences.
Latest version: 6.0.0

# @jameslnewell/tsconfig

Contains a [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file according to my preferences.

## Installation

NPM:

```bash
npm i -D @jameslnewell/typescript-config
cp node_modules/typescript-config/tsconfig.json tsconfig.json
``
```
npm package: @jameslnewell/workspace-utilities
Description: Utilities for finding and filtering `yarn` and `npm` workspaces.
Author: James Newell
Latest version: 0.5.2

# @jameslnewell/workspace-utilities

Utilities for finding and filtering `yarn` and `npm` workspaces.

## Usage

```ts
import {getDiff} from '@jameslnewell/git-utilities';
import {Project, getDependents} from '@jameslnewell/workspace-utilities';
import * as filters from '@jameslnewell/workspace-utilities/filters';

const diff = await getDiff();
const project = await Project.fromDirectory(process.cwd());

const changedWorkspaces = project.children.filter(filters.changed(diff));
const changedWorkspacesAndTheirDependents = Array.from(new Set([
  ...changedWorkspaces,
  ...changedWorkspaces.map(workspace => getDependents(workspace, {project}).flat()
]))
const workspacesThatRequireTesting = changedWorkspacesAndTheirDependents.filter(filters.script('test'))

console.log(workspacesToTest)
```
npm package: @jameslu123/sharedlib
Description: sharedlib React component
Latest version: 1.0.33

# sharedlib

[![Travis][build-badge]][build]
[![npm package][npm-badge]][npm]
[![Coveralls][coveralls-badge]][coveralls]

Describe sharedlib here.

[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
[build]: https://travis-ci.org/user/repo

[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.org/package/npm-package

[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
[coveralls]: https://coveralls.io/github/user/repo
npm package: @jamesmddoyle/phantom
Description: API mocker and traffic inspector with a built-in dashboard.
Author: James Doyle
Latest version: 0.2.1

# PHANTOM

[![npm version](https://img.shields.io/npm/v/%40jamesmddoyle%2Fphantom?color=5e4d8a)](https://www.npmjs.com/package/@jamesmddoyle/phantom)

Phantom is a low-level API mocker and traffic inspector. Built using raw Node.js TCP sockets. It includes a built in dashboard for real-time monitoring and route configuration.

## Features

- **Traffic Inspector**: View request and response headers, bodies, and latency in a real-time feed.
- **Chaos Engine**: Injected artificial delays and random error rates on a per-route basis.
- **Deep Search**: Filter request history by path, method, or content within the body.
- **Self-Contained**: The server serves both the mock API and the static dashboard UI on a single port.
- **Binary Support**: Capability to handle and serve binary assets like images.

## Installation

Install Phantom globally via npm:

```bash
npm i -g @jamesmddoyle/phantom
```

## Usage

Run `phantom init` to create a starter `routes.json` file in your current directory.

To start the server, run `phantom` in any directory. It will look for a `routes.json` file by default.

## CLI Options

- `--port`: The port to run the server on (default: 3001).
- `--config`: Custom path to a routes JSON file.
- `--delay`: Global latency override in milliseconds.
- `--error-rate`: Global failure rate override (0.0 to 1.0).
- `--verbose`: Show all system logs and debug information.
- `--quiet`: Hide all non-error logs (shows only errors).

## Route Configuration

Example `routes.json` structure:

```json
[
  {
    "path": "/api/users",
    "method": "GET",
    "status": 200,
    "body": { "id": 1, "name": "Phantom User" },
    "enabled": true,
    "delay": 500,
    "errorRate": 0.1
  }
]
```

## Commands

- `make dev`: Run the dashboard and server in development mode.
- `make build`: Build both projects for production.
- `make run`: Run the production build locally.
- `make test`: Run server-side tests.
npm package: @jamesmh/statica
Description: Dead simple zero config static site generator
Author: James Hickey
Latest version: 1.0.0

![logo](docs/img/logo.png)

Ever wish you could simply write some markdown files and convert them into web pages for your zero-fuss static site?

Introducing Statica - a dead simple zero config static site builder for people who don't need all that fancy "stuff". 

It's perfect for static sites when you simply want to write content in markdown and easily convert them to web pages!

![diagram](docs/img/diagram.png)

# Install

`npm install -g statica`

# Usage

## Create The Template File

First, you need a template that represents the "outer shell" of your HTML site.

Create a file `_template.html` in the root of your site's folder.

Next, just put whatever HTML you want into it!

## Injecting Content

Specify where content will be injected (from your markdown files) by adding the following to your template file:

`<!--@Content()-->`

The outer HTML might look like:

```html
<body>
    <h1>This is my header</h1>
    <!--@Content()-->
    <footer>
        This is my footer
    </footer>
</body>
```

## Writing Content

Write your markdown files (with an extension `.md`) anywhere you like. When compiled, each markdown file will be converted into an HTML file.

All other non-markdown files (HTML, JS, CSS, images, etc.) will be copied into `./www` for you too.

For example, your site layout might look like:

![pre-compiled](docs/img/pre-compiled.png)

After generating the site, the compiled layout will be (inside `./www`):

![pre-compiled](docs/img/compiled.png)

## Build It!

When installed as a global npm tool, open a terminal from the root of your site then run `statica`.

The compiled web site will be copied to a `www` folder.

![terminal](docs/img/terminal.png)

# Q&A

## Can I add plain HTML files?

Yes! Statica will copy them over to the `www` folder for you when building. This might be useful for one-off pages that do differ quite a bit from your overall template.

## Where do I put my site's assets (JS, CSS, etc.)?

Anywhere you want - except directly in the `www` folder since this is generated for you.

## Can I Use NPM Modules On My Site?

Sure! Statica will ignore your `node_modules` folder when building your site. Just make sure your compiled files (via webpack, etc.) are being referenced in your HTML pages.

## My Assets (JS, CSS) aren't working in my compiled site?

Are you using relative paths?
npm package: @jamesmoey/middleware-axios
Description: Axios with express/koa like middleware
Author: Dmitry Petrov
Latest version: 2.0.0-alpha.1

# middleware-axios

Axios with express/koa like middleware

## Install

Using npm:

```bash
npm install --save middleware-axios
```

Using yarn:

```bash
yarn add middleware-axios
```

## Usage

Wrap axios instance (interface will be saved):

```javascript
import { create } from 'middleware-axios';

// create wrapped instance in the same way as normal axios instance
const api = create({
  baseURL: 'https://some-domain.com/api/',
});

// add middleware if you want
api.use(async (requestConfig, next) => {
  // do something before request start...

  await next(requestConfig); // calling next is required

  // ...and do something after
});

// use like normal axios
api.get('/user/12345').then(response => {
  console.log(response.data);
  console.log(response.status);
  console.log(response.statusText);
  console.log(response.headers);
  console.log(response.config);
});

console.log(api.axiosInstance); // pure instance

```

### Instance methods

The available instance methods are listed below.
Each method works like in original axios instance.

- **axios.request(config)**
- **axios.get(url[, config])**
- **axios.delete(url[, config])**
- **axios.head(url[, config])**
- **axios.options(url[, config])**
- **axios.post(url[, data[, config]])**
- **axios.put(url[, data[, config]])**
- **axios.patch(url[, data[, config]])**
npm package: @jamesnimlos/express-caja-sanitizer
Description: An express middleware inspired from express-sanitizer but additionally sanitizes URL params. It also gives an option to provide a preprocessor function to decide whether a (key, value) pair should be sanitized or not.
Author: Srivathsa Pasumarthi
Latest version: 1.1.2

# express-caja-sanitizer
An express middleware inspired from express-sanitizer but additionally sanitizes URL params. It also gives an option to provide a preprocessor function to decide whether a (key, value) pair should be sanitized or not.

[![Build Status](https://travis-ci.org/pvsrivathsa/express-caja-sanitizer.png)](https://travis-ci.org/pvsrivathsa/express-caja-sanitizer.png)

## Installation
```
npm install express-caja-sanitizer
```

## Usage
Needs to be called after express.bodyParser() and before anything that requires the sanitized input, e.g.:

```
var express = require('express');
var bodyParser = require('body-parser');
var cajaSanitizer = require('express-caja-sanitizer');

var app = express();

app.use(bodyParser());
app.use(cajaSanitizer());

```

## URL Params
This module by default sanitizes the request URL params (`req.params`), apart from request body and query string params, e.g.:

```
http://www.myapp.com/rest/user/<script>console.log("hello")</script>bob/details
```

will be sanitized as

```
http://www.myapp.com/rest/user/bob/details
```

## Options

#### `shouldSanitize`
When `shouldSanitize` function is provided as an option, the module will sanitize only the (key, value) pairs for which the function returns `true`.

For example, if we don't want to sanitize XML values then the preprocesser function can be

```
var shouldSanitize = function(key, value) {
  return !value.startsWith('<?xml version="1.0"')
}
```

##Limitations
This is a basic implementation of [Caja-HTML-Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) with the specific purpose of mitigating against persistent XSS risks.

##Caveats
This module trusts the dependencies to provide basic persistent XSS risk mitigation. A user of this package should review all packages and make their own decision on security and fitness for purpose.
npm package: @jamesnimlos/gh-pages
Description: Generates or updates a gh-pages branch from the current directory
Author: James Nimlos
Latest version: 1.0.1

# gh-pages-node
a node based script for adding or updating gh-pages from a specific distribution directory.

```
Usage: gh-pages-node [options] <dist directory> [gh-pages directory]

Options:
  --update, -u   updating already existing gh-pages (defaults to true if
                 gh-pages directory already exists)                    [boolean]
  --message, -m  custom commit message gh-pages
  --help, -h     Show help                                             [boolean]
```

##### How-to:
```sh
# clone the repo
git clone git@github.com:JamesNimlos/gh-pages-node.git

# simlink it to your bin
ln -s gh-pages-node/gh-pages-node /usr/local/bin/gh-pages-node

# navigate to your project with gh-pages to publish
cd ~/path/to/project

# run your buid script, probably:
npm run build

# use the tool
gh-pages-node dist gh-pages
```

Boom, you're killing it with some sweet gh-pages.

[![Abed celebrates](http://i.giphy.com/zPVRKhPsUP5lK.gif)](http://gph.is/29lbuHC)
npm package: @jamesnimlos/rollup-plugin-cpy
Description: rollup plugin to easily copy files and folders.
Author: Shriyans Bhatnagar
Latest version: 2.0.0

# rollup-plugin-cpy

[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![MIT License](https://img.shields.io/npm/l/rollup-plugin-cpy.svg?style=flat-square)](https://github.com/shrynx/rollup-plugin-cpy/blob/master/LICENSE)
![rollup-plugin-cpy-status](https://david-dm.org/shrynx/rollup-plugin-cpy.svg?path=packages/rollup-plugin-cpy)
[![npm version](https://badge.fury.io/js/rollup-plugin-cpy.svg)](https://badge.fury.io/js/rollup-plugin-cpy)

> rollup plugin to easily copy files and folders.

## Installation

* yarn

```sh
yarn add -D rollup-plugin-cpy
```

* npm

```sh
npm i -D rollup-plugin-cpy
```

## Usage

This plugin uses [cpy](https://github.com/sindresorhus/cpy) by [@sindresorhus](https://github.com/sindresorhus).

All the options map to the `cpy` package apart from `verbose`.

It takes a config object

```js
{
  files: string | glob | Array<string & glob>
  dest: string,
  options: {
    verbose: boolean,
    ...restOptions
  }
}
```

The verbose option if set to true print out each file copying log on console.

`restOptions` are same as [options passed to cpy](https://github.com/sindresorhus/cpy#options)

```js
import copy from 'rollup-plugin-cpy'

...

plugins: [
  ...
  copy({
    files: ['src/*.png', '!src/goat.png'],
    dest: 'dist'
    options: {
      verbose: true,
      ...
    }
  })
]

...
```

It can also take an array of [above mentioned config object](#usage)

```js
import copy from 'rollup-plugin-cpy'

...

plugins: [
  ...
  copy([
        { files: 'src/**/*.png', dest: './dist/images' },
        { files: 'src/**/*.mp3', dest: './dist/audio' },
        { files: 'src/**/*.webm', dest: './dist/video' },
      ]),
]

...
```
npm package: @jamespetterson/uikit
Description: Set of UI components for pancake projects
Latest version: 1.2.0

# 🥞 shibfan UIkit

**This repository is not used anymore. See the [https://github.com/pancakeswap/pancake-toolkit](Pancake toolkit) instead**

[![Version](https://img.shields.io/npm/v/@pancakeswap-libs/uikit)](https://www.npmjs.com/package/@pancakeswap-libs/uikit) [![Size](https://img.shields.io/bundlephobia/min/@pancakeswap-libs/uikit)](https://www.npmjs.com/package/@pancakeswap-libs/uikit)

Pancake UIkit is a set of React components and hooks used to build pages on Pancake's apps. It also contains a theme file for dark and light mode.

## Install

`yarn add @pancakeswap-libs/uikit`

## Setup

### Theme

Before using Pancake UIkit, you need to provide the theme file to styled-component.

```
import { ThemeProvider } from 'styled-components'
import { light, dark } from '@pancakeswap-libs/uikit'
...
<ThemeProvider theme={isDark}>...</ThemeProvider>
```

### Reset

A reset CSS is available as a global styled component.

```
import { ResetCSS } from '@pancakeswap-libs/uikit'
...
<ResetCSS />
```

### Types

This project is built with Typescript and export all the relevant types.

## How to use the UIkit

If you want to use components from the UIkit, check the [Storybook documentation](https://pancakeswap.github.io/pancake-uikit/)
npm package: @jamesptagg/erc21pq-snap
Description: MetaMask Snap for ERC-21 ZK-guarded transfers
Latest version: 0.2.2

# ERC-21 PQ Snap

MetaMask Snap for ERC-21 ZK-guarded transfers with STARK proofs (quantum-resistant).

## Features

- **ethvaultpq_bindHD** - Bind HD commitment to token contract
- **ethvaultpq_enableZKGuard** - Enable quantum lock
- **ethvaultpq_disableZKGuard** - Disable quantum lock (requires STARK proof)
- **ethvaultpq_transferZK** - Transfer with STARK proof
- **ethvaultpq_getInfo** - Get account info

## Local Development (Port 8080)

### Prerequisites

- Node.js >= 18.6.0
- Yarn
- MetaMask Flask (for Snap testing)

### Install Dependencies

```bash
cd snap
yarn install
```

### Build

```bash
yarn build
```

### Start Development Server (Port 8080)

```bash
yarn start
```

This will serve the Snap at `http://localhost:8080`.

### Connect to MetaMask Flask

1. Install [MetaMask Flask](https://metamask.io/flask/)
2. Open your dapp or browser console
3. Connect to the local Snap:

```javascript
await ethereum.request({
  method: 'wallet_requestSnaps',
  params: {
    'local:http://localhost:8080': {},
  },
});
```

## Publish to npm (for production)

### Prerequisites

- npm account with publish access
- Authenticated: `npm login`

### Publish

```bash
# Build first
yarn build

# Update version if needed
npm version patch

# Publish to npm
npm publish --access public
```

### Install from npm

Once published, users can install with:

```javascript
await ethereum.request({
  method: 'wallet_requestSnaps',
  params: {
    'npm:@erc21pq/snap': {},
  },
});
```

## Usage Example

```javascript
// Connect Snap
const snapId = 'local:http://localhost:8080';

// Bind HD commitment
await ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId,
    request: {
      method: 'ethvaultpq_bindHD',
      params: { tokenAddress: '0x...' },
    },
  },
});

// Enable ZK guard
await ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId,
    request: {
      method: 'ethvaultpq_enableZKGuard',
      params: { tokenAddress: '0x...' },
    },
  },
});

// Transfer with STARK proof
await ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId,
    request: {
      method: 'ethvaultpq_transferZK',
      params: {
        tokenAddress: '0x...',
        to: '0x...',
        amount: '100',
      },
    },
  },
});

// Disable ZK guard (requires proof)
await ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId,
    request: {
      method: 'ethvaultpq_disableZKGuard',
      params: { tokenAddress: '0x...' },
    },
  },
});
```

## Security

- HD secret is stored securely in Snap state
- STARK proofs are quantum-resistant (no elliptic curves)
- No trusted setup required
- Proofs are 1024 bytes (larger than SNARKs but more secure)

## License

MIT
npm package: @jamessawle/java-lambda
Description: Functional programming library bringing lazily evaluated Java Optional and Streams to Javascript and Typescript
Author: James Sawle
Latest version: 0.1.0

# Java Lambda

A package to provide functional primitives, inline with Java's functional patterns for Javascript, following the Java SE SDK for provided features.

The name is based on the fact that the primitives were added as part of Java 8's Lambda functions.

## Install

Node: `npm i @jamessawle/java-lambda`

## Usage

### Optional

The [Optional](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Optional.html) class allows for safe processing of data that may not be present.

```ts
import { Optional } from '@jamessawle/java-lambda'

const input = 12 | undefined
const result = Optional.ofNullable(input)
  .map((x) => x * 2)
  .filter((x) => x > 20)
  .orElseGet(5)

// 12 => 24
// undefined => 5
```

**Note**
Optionals are not intended to be used as object values or method parameters, but instead a clear way to represent "no result" - [designer of Optional type](https://stackoverflow.com/questions/26327957/should-java-8-getters-return-optional-type/26328555#26328555).

### Stream (Not implemented yet)

The [Stream](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Stream.html) class allows for the processing of data in the form of a pipeline. Utility methods are provided to turn different types into a Stream.

Whilst similar to the utility methods `map`, `filter` etc. on Arrays in Javascript; the Stream class will lazily operate on each element in the Stream, only processing data that is required to fulfill the final result.

In the following example, only the first element in the provided array will ever be processed:

```ts
const result = Stream.of([12, 24, 36, 48, 60])
  .map((x) => x / 2)
  .filter((x) => x < 20)
  .findFirst()

// => 6
```
npm package: @jamessawle/request-context
Description: Store data across the lifecycle of a request using CLS
Author: James Sawle
Latest version: 0.1.0

# Request Context

This library provides a simple mechanism to store and retrieve data across the lifecycle of a request within Express, without having to pass objects around.

```javascript
import {getContext, setupContextMiddleware} from '@jamessawle/request-context';
import express from 'express';

// Setup
const app = express();
app.use(setupContextMiddleware('some-unique-id'));

// Somewhere in request handling code
getContext().set('where', 'there');

// Elsewhere in request handling code
const data = getContext().get('where'); //will equal 'there'
```

## How it works

Under the hood, the library is use continuation local storage, powered by [async-hooks](https://nodejs.org/api/async_hooks.html) using [cls-hooked](https://www.npmjs.com/package/cls-hooked). This however may change in any release in the future.

Similar libraries:

- `express-http-context`
- `express-cls-hooked`
- `express-ctx`

However, unlike these libraries, this library provides mechanisms to find out what data is contained within the Context. This is required to enable the following feature.

## Stop corruption of the Context

A number of middleware are known to corrupt `async-hooks`, such as `body-parser`. Unlike the prior libraries, this library provides a mechanism to wrap such middleware to ensure that the Context is maintained.

```typescript
import { middlewareWrapper } from '@jamessawle/request-context';
import bodyParser from 'body-parser';

app.use(middlewareWrapper(bodyParser));
```

The wrapper copies the content of the Context before calling the delegate middleware. Once the delegate has completed, the wrapper then resets the Context to the retrieved content and then calls the next middleware in the chain.

The downside of this implementation means that any data that is set or changed during a wrapped middleware will be lost. This may be revisited in future.

## License

[MIT](LICENSE)
npm package: @jamesshr/common-db
Description: common database table schema and column with typeorm
Author: JamesShr
Latest version: 1.0.0

# Common-db

<p>
Supply some entity and column whitch are usually used. , Only need to import the entity and then design the relation for secondary development when developing a project.
</p>

---
### Entity

- Auth
- Date
---
### Cloumn
- Coordinate
- CreateDate
- UpdateDate
- DeleteDate
- ModifiedBy
- IsDeleted
---

### Enum
- Role
npm package: @jamesst20/inertia-core
Description: A framework for creating server-driven single page apps.
Latest version: 2.0.8

# Inertia.js

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.

Visit [inertiajs.com](https://inertiajs.com/) to learn more.
npm package: @jamesst20/inertia-svelte5
Description: The Svelte 5 adapter for Inertia.js
Latest version: 1.0.16-6
Deprecated: Deprecated in favor of @jamesst20/inertia-svelte which is now my supported Svelte 5 adapter

# Inertia.js Svelte 5 Adapter

Visit [inertiajs.com](https://inertiajs.com/) to learn more.

## Installation

```
npm install @jamesst20/inertia-svelte5
yarn add @jamesst20/inertia-svelte5
pnpm add @jamesst20/inertia-svelte5
```