open-index/open-npm huggingface dataset:
npm package: @js-system/timespan
Description: **With npm:**
Author: Lucas Dornelas
Latest version: 0.0.6

## INSTALLATION

**With npm:**

```typescript
npm install --save @js-system/timespan
```

## SAMPLES

```typescript
import { TimeSpan } from '@js-system/timespan';

let time1 = TimeSpan.parse("01:00:00");
let time2 = TimeSpan.parse("02:00:00");

expect(time2 > time1).toBeTruthy();
expect(time1.hours).toBe(1);
expect(time2.hours).toBe(2);

let time3 = TimeSpan.parse("00:00:05");
expect(time3.hours).toBe(0);
expect(time3.minutes).toBe(0);
expect(time3.seconds).toBe(5);
```

## CONTRIBUTING

We'd love for you to contribute to our source code! We just ask to:

- Write tests for the new feature or bug fix that you are solving
- Ensure all tests pass before send the pull-request (Use: `npm test`)
- Pull requests will not be merged if:
  - has not unit tests
  - reduce the code coverage
  - not passing in the `npm test` task

## LICENSE

Copyright (c) 2024 Lucas Dornelas

Licensed under the MIT license.
npm package: @js-system/tree
Description: **With npm:**
Author: Lucas Dornelas
Latest version: 0.0.2

## INSTALLATION

**With npm:**

```typescript
npm install --save @js-system/tree
```

## EXAMPLES

```typescript
import { TreeNode } from "@js-system/tree";

const tree = TreeNode.treeFromList(
  [
    {
      id: "child1",
      parentKey: "parent",
    },
    {
      id: "parent",
      parentKey: "root",
    },
    {
      id: "child2",
      parentKey: "parent",
    },
    {
      id: "root",
      parentKey: null,
    },
  ],
  (x) => x.id,
  (x) => x.parentKey,
);
```

```typescript
import { TreeNode } from "@js-system/tree";

const tree = TreeNode.parseTree([
  {
    key: "root",
    children: [
      {
        key: "parent",
        children: [
          {
            key: "child1",
          },
          {
            key: "child2",
          },
        ],
      },
    ],
  },
]);
```

```typescript
import { TreeNode } from "@js-system/tree";

const root = new TreeNode("root");
const parent = new TreeNode("parent");
const child1 = new TreeNode("child1");
const child2 = new TreeNode("child2");

root.addChildNode(parent);
parent.addChildNode(child1);
parent.addChildNode(child2);
```

## CONTRIBUTING

We'd love for you to contribute to our source code! We just ask to:

- Write tests for the new feature or bug fix that you are solving
- Ensure all tests pass before send the pull-request (Use: `npm test`)
- Pull requests will not be merged if:
  - has not unit tests
  - reduce the code coverage
  - not passing in the `npm test` task

## LICENSE

Copyright (c) 2024 Lucas Dornelas

Licensed under the MIT license.
npm package: @js-telecortex-2/js-telecortex-2-util
Description: A Util library for JS-Telecortex-2
Author: Moobase Labs
Latest version: 1.1.6

This is a basic util library to share code between the client and server libraries for [JS-Telecortex-2](https://github.com/Laserphile/JS-Telecortex-2)

[![Build Status](https://travis-ci.org/Laserphile/JS-Telecortex-2-Util.svg?branch=master)](https://travis-ci.org/Laserphile/JS-Telecortex-2-Util)
[![Maintainability](https://api.codeclimate.com/v1/badges/4172f27f149a4c7f4201/maintainability)](https://codeclimate.com/github/Laserphile/JS-Telecortex-2-Util/maintainability)
[![codecov](https://codecov.io/gh/Laserphile/JS-Telecortex-2-Util/branch/master/graph/badge.svg)](https://codecov.io/gh/Laserphile/JS-Telecortex-2-Util)

# To recompile modifications made to this package when installed under node_modules

```
yarn global add @babel/cli @babel/core
export PATH="$PATH:$(yarn global bin)"
cd node_modules/@js-telecortex-2/js-telecortex-2-util/
babel src --out-dir lib
```
npm package: @js-toolkit/config-utils
Description: Shared utilities for project configuration: extensions, paths, dependency detection
Author: VZH
Latest version: 1.0.1

# @js-toolkit/config-utils

[![npm](https://img.shields.io/npm/v/@js-toolkit/config-utils.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/config-utils)
[![license](https://img.shields.io/npm/l/@js-toolkit/config-utils.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/config-utils)

Shared utilities for project configuration: file extensions, dependency detection, and path resolution.

## Install

```bash
pnpm add @js-toolkit/config-utils
```

## Exports

### `extensions`

Module extension lists and glob helpers.

```ts
import {
  moduleExtensions,
  getFilesGlob,
  getTSExtensions,
  getJSExtensions,
  getSXExtensions,
  getTSXExtensions,
  getNonSXExtensions,
} from '@js-toolkit/config-utils/extensions';

getTSExtensions();              // ['.ts', '.mts', '.cts', '.tsx', ...]
getJSExtensions();              // ['.js', '.mjs', '.cjs', '.jsx', ...]
getFilesGlob(getTSExtensions(), 'src/'); // 'src/**/*.{ts,mts,cts,tsx,...}'
getTSExtensions(true);          // ['*.ts', '*.mts', '*.cts', '*.tsx', ...]
```

### `getInstalledPackage`

Check if a package is installed and resolvable.

```ts
import { getInstalledPackage } from '@js-toolkit/config-utils/getInstalledPackage';

const pkg = getInstalledPackage('typescript-eslint', { resolvePaths: true });
// 'typescript-eslint' if installed, undefined otherwise
```

### `getProjectDependencies`

Read all dependency names from a project's `package.json`.

```ts
import { getProjectDependencies } from '@js-toolkit/config-utils/getProjectDependencies';

const deps = getProjectDependencies([process.cwd()]);
// Set<string> { 'react', 'typescript', ... }
```

### `findPath`

Find the first existing path from a list of candidates.

```ts
import { findPath } from '@js-toolkit/config-utils/findPath';

const tsconfig = findPath('tsconfig.json', [process.cwd(), '/fallback/dir']);
// Absolute path to the first found tsconfig.json, or undefined
```

### `defaultRequire`

A `require` function created via `createRequire(import.meta.url)` for use in ESM modules.

```ts
import { defaultRequire } from '@js-toolkit/config-utils/defaultRequire';

const pkg = defaultRequire('some-cjs-package');
```

## License

MIT
npm package: @js-toolkit/mobx-utils
Description: MobX utils
Author: VZH
Latest version: 2.13.1

# MobX Utils

[![npm package](https://img.shields.io/npm/v/@js-toolkit/mobx-utils.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/mobx-utils)

Useful utils for mobx.

```ts
import { observable } from 'mobx';
import { attachSelectors, createRootStore, createStore } from '@js-toolkit/mobx-utils/store/object';

const rootStore0 = createRootStore({
  store1: createStore(
    {
      prop1: 0,
      prop2: 0,
      prop3: [],
      prop4: '',
      method: () => {},
    },
    {
      prop3: observable.shallow,
      prop4: false,
    }
  ),
});

const rootStore = attachSelectors(rootStore0, {
  get isProp1(): boolean {
    return root.store1.prop1 > 0;
  },
});
```
npm package: @js-toolkit/prettier-config
Description: Shared Prettier config
Author: VZH
Latest version: 1.0.1

# @js-toolkit/prettier-config

[![npm](https://img.shields.io/npm/v/@js-toolkit/prettier-config.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/prettier-config)
[![license](https://img.shields.io/npm/l/@js-toolkit/prettier-config.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/prettier-config)

Shared Prettier config.

## Install

```bash
pnpm add -D @js-toolkit/prettier-config prettier
```

## Config

| Option | Value |
|--------|-------|
|  `semi` | true |
|  `singleQuote` | true |
|  `jsxSingleQuote` | false |
|  `trailingComma` | all |
|  `printWidth` | 100 |
|  `tabWidth` | 2 |
|  `useTabs` | false |
|  `bracketSpacing` | true |
|  `bracketSameLine` | false |
|  `singleAttributePerLine` | false |
|  `arrowParens` | always |
|  `endOfLine` | lf |


## Usage

### ESM

```js
// prettier.config.js
export { default } from '@js-toolkit/prettier-config';
```

### CJS

```js
// prettier.config.cjs
module.exports = require('@js-toolkit/prettier-config').default;
```

### `package.json`

```json
{
  "prettier": "@js-toolkit/prettier-config"
}
```

### With overrides

```js
// prettier.config.js
import config from '@js-toolkit/prettier-config';

export default {
  ...config,
  printWidth: 120,
};
```

## License

MIT
npm package: @js-toolkit/styled-components
Description: Styled react components powered by @mui/@mui/system/styled
Author: VZH
Latest version: 1.24.0

# Styled React Components

[![npm package](https://img.shields.io/npm/v/@js-toolkit/styled-components.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/styled-components)

Powered by [@mui/system/styled](https://github.com/mui-org/material-ui/tree/master/packages/mui-system).
npm package: @js-toolkit/tsconfig
Description: Shared TypeScript configurations
Author: VZH
Latest version: 1.0.1

# @js-toolkit/tsconfig

[![npm](https://img.shields.io/npm/v/@js-toolkit/tsconfig.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/tsconfig)
[![license](https://img.shields.io/npm/l/@js-toolkit/tsconfig.svg?style=flat-square)](https://www.npmjs.org/package/@js-toolkit/tsconfig)

Shared TypeScript configurations.

## Install

```bash
pnpm add -D @js-toolkit/tsconfig typescript
```

## Configs

### `common`

Strict TypeScript config for libraries and Node.js projects.

- `module: "nodenext"` / `moduleResolution: "nodenext"`
- `strict: true` with all additional strict checks enabled
- `verbatimModuleSyntax: true`
- `rewriteRelativeImportExtensions: true`
- `jsx: "react-jsx"`

```json
{
  "extends": "@js-toolkit/tsconfig/common",
  "compilerOptions": {
    "outDir": "dist",
    "rootDir": "src"
  },
  "include": ["src"]
}
```

### `bundler`

Extends `common` with bundler-friendly settings. Suitable for projects built with Webpack, Vite, or other bundlers.

- `module: "esnext"` / `moduleResolution: "bundler"`
- `noEmit: true`

```json
{
  "extends": "@js-toolkit/tsconfig/bundler",
  "compilerOptions": {
    "types": ["node"]
  },
  "include": ["src"]
}
```

## Included Options

<details>
<summary>Full <code>common</code> compilerOptions</summary>

| Option | Value |
|--------|-------|
| `target` | ESNext |
| `module` | nodenext |
| `moduleResolution` | nodenext |
| `lib` | DOM, DOM.Iterable, ESNext |
| `jsx` | react-jsx |
| `strict` | true |
| `noUnusedLocals` | true |
| `noUnusedParameters` | true |
| `noImplicitReturns` | true |
| `noImplicitOverride` | true |
| `noFallthroughCasesInSwitch` | true |
| `noUncheckedSideEffectImports` | true |
| `exactOptionalPropertyTypes` | true |
| `esModuleInterop` | true |
| `resolveJsonModule` | true |
| `verbatimModuleSyntax` | true |
| `rewriteRelativeImportExtensions` | true |
| `forceConsistentCasingInFileNames` | true |
| `importHelpers` | true |
| `skipLibCheck` | true |
| `sourceMap` | true |
| `incremental` | true |

</details>

## License

MIT
npm package: @js-types-1/string
Description: Lightweight string type checker
Latest version: 1.0.0
Deprecated: Moved to @js-types-runtime/string

# @js-types-1/string

Lightweight string type checker. Zero dependencies.

## Installation

npm install @js-types-1/string

## Usage

import { type, check } from '@js-types-1/string';

check('hello'); // true
check(42); // false

type; // 'string'
npm package: @js-types-runtime/string
Description: Lightweight string type checker
Latest version: 2.0.1

# @js-types-runtime/string

Lightweight string type checker. Zero dependencies.

## Installation

```bash
npm install @js-types-runtime/string
```

## Usage

```js
import { string } from '@js-types-runtime/string';

string('hello'); // true
string(''); // true

string(42); // false
string(null); // false
```

## API

### `string(value)`

Checks if a value is a string.

- **value**: `unknown`
- **returns**: `boolean`

## TypeScript

This package includes type definitions with a type predicate:

```ts
const string: (v: unknown) => v is string;
```

So you get type narrowing:

```ts
const x: unknown = 'hello';

if (string(x)) {
  x.toUpperCase(); // ✅ x is string
}
```

## License

MIT
npm package: @js-util-fn/compare-version
Description: > compareVersion
Author: lamovv
Latest version: 1.0.1

# `@js-util-fn/compare-version`

> compareVersion

[![Coverage Status](https://coveralls.io/repos/github/lamovv/js-utils-compare-version/badge.svg?branch=master)](https://coveralls.io/github/lamovv/js-utils-compare-version?branch=master)
[![NPM version](https://img.shields.io/npm/v/@js-util-fn/compare-version.svg)](https://www.npmjs.com/package/@js-util-fn/compare-version)

- 配置coveralls token
  - [ADD REPO](https://coveralls.io/repos/new)，将关联的仓库置为`ON`，进入`DETAILS` 里查看`repo_token`
  - 将 `repo_token` 配置到 `.coveralls.yml`：`repo_token: ua...`
  
## Usage

```js
import {
  empty
} from '@js-util-fn/compare-version';
// result true
empty([]);
```

## mock
1. mock内配置mock数据，如：getData.json
2. 请求接口

```js
fetch('/api/getData.json')
```

## TC
1. `__test__` 编写Test Case
2. `npm run test` 运行测试用户并生成报告
3. `npm run dev`启动server后，可访问：`http://localhost/coverage` 查看报告页面

## Dev
1. 默认使用`yarn`安装npm包，若无请先安装：`npm i -g yarn`
2. 初始化环境：`npm run init`
3. 启动开发服务：`npm run dev`
  - 自动打开浏览器：`npm run dev:open`
  - 若提示80端口被占用问题，可注掉或修改 webpack.config.js 的 port
4. 构建：：`npm run build`
  - 默认构建cjs与es6 module
  - 若全部构建：`$ npm run build:all`
5. 使用命令可一步完成git push提交：`$ npm run push -- "your-commit-message"`
  - your-commit-message：为git commit提交时的message，自行输入
  - 如：`$ npm run push -- "feat(scope): add yy"`
  - **message格式参照 `commitlint.config.js` 规范提交**
6. 使用命令可一步完成提交git并发布npm包：`npm run pub -- "your-commit-message"`
  - 还可指定npm包版本位(patch|minor|major)，默认为patch，自动+1：`npm run pub -- "your-commit-message" -v minor`
npm package: @js-util-fn/url
Description: > 仅依赖JS Engine运行环境的URL 解析、修改/追回参数hash等方法集
Author: lamovv
Latest version: 1.0.8

# `@js-util-fn/url`

> 仅依赖JS Engine运行环境的URL 解析、修改/追回参数hash等方法集

## Usage
1. 添加依赖

```
$ yarn add @js-util-fn/url
```

2. 应用
    
```js
import { 
  parse, 
  setSearch
} from '@js-util-fn/url';

const r = parse('/pages/foo/index?&a=1&b=2&c=3#hash');
//return
r = {
  "href": "/pages/foo/index?&a=1&b=2&c=3#hash",
  "origin": "",
  "pathname": "/pages/foo/index",
  "search": "?&a=1&b=2&c=3",
  "hash": "#hash",
  "params": {
    "a": "1",
    "b": "2",
    "c": "3"
  }
}


parse('https://m.foo.com/foo/index.html?&a=1&b=2&c=3#hash');
//return 
{
  "href": "https://m.foo.com/foo/index.html?&a=1&b=2&c=3#hash",
  "origin": "https://m.foo.com",
  "protocol": "https:",
  "host": "m.foo.com",
  "hostname": "m.foo.com",
  "pathname": "/foo/index.html",
  "port": undefined,
  "search": "?&a=1&b=2&c=3",
  "hash": "#hash",
  "params": {
    "a": "1",
    "b": "2",
    "c": "3"
  }
}

//修改或追加参数
setSearch('/pages/foo/index?&a=1&b=2&c=3#hash', {a:7, e:9}, 'newHash');
//return 
"/pages/foo/index?a=7&b=2&c=3&e=9#newHash"


setSearch('https://m.foo.com/pages/foo/index?&a=1&b=2&c=3#hash', {a:7, e:9}, 'newHash');
//return
"https://m.foo.com/pages/foo/index?a=7&b=2&c=3&e=9#newHash"
```

## Dev
- 初始化环境：`npm run init`
- 启动开发：`npm run dev`
  - 自动打开浏览器：`npm run dev:open`
- 编译构建：`npm run build`
- 发布：`npm run pub`
  - 发布beta包：`npm run beta`
npm package: @js-util/array-shuffle
Description: Given an array, shuffles a cloned copy, and returns it. (Fisher–Yates method)
Author: picocreator
Latest version: 1.0.3

# fetch-nested-value

Given an array, shuffles a cloned copy, and returns it. [(Fisher–Yates method)](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm)

This does not aim for true perfect randomness. Just to be good enough and fast

# npm install

```.bash
npm install --save @js-util/array-shuffle
```

# Example usage

```.js
// Importing the module
const arrayShuffle = require("@js-util/array-shuffle");

// Example array to shuffle
const array = [1,2,3,4];

// Shuffle the array
let shuffled = arrayShuffle( array ); 
```

# Its code

```.js
/**
 * Given an array, shuffle its content randomly.
 * Note that the original array is not affected
 * 
 * This does the : Fisher–Yates shuffle underneath the hood
 * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
 * 
 * This does not aim for true perfect randomness. Just to be good enough and fast
 * 
 * @param {Array<*>} array 
 * 
 * @return {Array<*>} shuffled array
 */
function arrayShuffle(array) {
	// Clone the array
	array = arrays.slice(0);

	// Shuffle it
	for (let i = array.length - 1; i > 0; i--) {
		const j = Math.floor(Math.random() * (i + 1));

		//
		// Note that the below code is equivalent to
		//
		// ```
		// var temp = array[i];
		// array[i] = array[j];
		// array[j] = temp;
		// ```
		//
		[array[i], array[j]] = [array[j], array[i]];
	}

	// Return the shuffled array
	return array;
}

// Export the function
module.exports = arrayShuffle;
```
npm package: @js-util/config-loader
Description: Quick and simple config loading, with sane defaults to get an application started
Author: picocreator
Latest version: 1.2.7

# config-loader
Quick and simple config loading, with sane defaults to get an application started

# npm install

```.bash
npm install --save @js-util/config-loader
```

# Example usage

```.js
const ConfigLoader = ("@js-util/config-loader")

//
// Load the various config files (if found),
// along with the various default value fallbacks
//
const config = new ConfigLoader({
	fileList: ["./config.json", "./config.hjson"],
	default: require("./config.default.js"),
	configDirList: ["./config/"],
});

//
// Fetch some config values
//
config.fetchValue("hello.world")
```
npm package: @js-util/config-object-merge
Description: Given two config like object, merge them together - think if it as a recrusive merge that does *not* merge arrays
Author: picocreator
Latest version: 1.0.4

# config-object-merge

Given two config like object, merge them together - think if it as a recrusive merge that does *not* merge arrays

# npm install

```.bash
npm install --save @js-util/config-object-merge
```

# Example usage

```.js
// Importing the module
const configObjectMerge = require("@js-util/config-object-merge");

// Example object to merge into
let target = {
	"hello": {
		"world" : "its ok!",
		"array" : [
			"this will not be merged in",
			{
				"note": "nor will this"
			}
		]
	},
	"but" : "this would"
};

// Using the following data
let merge = {
	"hello": {
		"array": [
			{
				"note" : "this will replace the whole array"
			}
		]
	},
	"but"  : "and change this value",
	"with" : "this extra field"
}

// Merge them together
configObjectMerge( target, merge ); 

// And you would get the following result
let result = {
	"hello": {
		"world" : "its ok!",
		"array": [
			{
				"note" : "this will replace the whole array"
			}
		]
	},
	"but"  : "and change this value",
	"with" : "this extra field"
}

// ALTERNATIVELY, you could use its .all array varient
configObjectMerge.all( [{}, target, merge] );
```
npm package: @js-util/fetch-nested-value
Description: Fetch nested value within an object, using a dot notation string, eg: "hello.world"
Author: picocreator
Latest version: 1.0.4

# fetch-nested-value

Fetch nested value within an object, using a dot notation string, eg: "hello.world"

# npm install

```.bash
npm install --save @js-util/fetch-nested-value
```

# Example usage

```.js
// Importing the module
const fetchNestedValue = require("@js-util/fetch-nested-value");

// Example object to fetch from
const obj = {
	"hello": {
		"world" : "its ok!"
	}
};

// This fetches and return a nested value
fetchNestedValue( obj, "hello.world" ); // > "its ok!"
```
npm package: @js-util/is-trueish
Description: A very relaxed varient of `=== true`. Validate that the given param is true, 'true', 1, or '1'
Author: picocreator
Latest version: 1.0.0

# Is Trueish

A very relaxed varient of `=== true`. Validate that the given param is true, 'true', 1, or '1'

# npm install

```.bash
npm install --save @js-util/is-trueish
```

# Example usage

```.js
// Importing the module
const isTrueish = require("@js-util/is-trueish");

// Validate if isTrueish
if( isTrueish(someConfig) ) {
    // does something
}
```

# Its code

```.js
/**
 * Returns true if the given value is any of the following strictly
 * 
 * - true
 * - "true"
 * - 1
 * - "1"
 * 
 * @param {*} val to evaluate
 * @return {boolean} true/false accordingly
 */
function isTrueish(val) {
	return val === true || val === 1 || val === "1" || val === "true"
}

// Export the function
module.exports = isTrueish;
```
npm package: @js-util/net-socket-connect
Description: Given the remote port/host, setup a low level, net.Socket. With callbacks and connect timeout!
Author: picocreator
Latest version: 1.0.2

# net-socket-connect

Given the remote port/host, setup a low level, net.Socket. With callbacks and connect timeout!

# npm install

```.bash
npm install --save @js-util/net-socket-connect
```

# Example usage

> PS: This is incomplete code, you will need to modify for your actual use case.

```.js
// Load the module
const netSocketTimeout = require("@js-util/net-socket-connect);

// Create the server with the socket listening event
let remotesocket = netSocketTimeout(80, "127.0.0.1", (socket, err) => {
	
	if( err ) {
		console.error(err);
		return;
	}

	doSomethingWithSocket(socket);

}, 5000 /* connect timeout in ms */ );
```
npm package: @js-util/promise-sleep
Description: Returns a promise, which resolve after the specified sleep itme (ms)
Author: picocreator
Latest version: 1.0.5

# Promise Sleep

Returns a promise, which resolve after the specified sleep itme (ms)

# npm install

```.bash
npm install --save @js-util/promise-sleep
```

# Example usage

```.js
// Importing the module
const promiseSleep = require("@js-util/promise-sleep");

// Await sleep in ms
// 1000 ms -> 1 second
await promiseSleep(1000)
```

# Its code

```.js
// Store a reference to the global setTimeout,
// in case it gets replaced (e.g. sinon.useFakeTimers())
const timeoutFunction = setTimeout;

/**
 * @param {Int} timeout in milliseconds to sleep by
 * @return a promise which resolves on timeout, returns no actual value
 */
function promiseSleep(timeout) {
    return new Promise((resolve) => {
        timeoutFunction(resolve, timeout);
    });
}

// Export the function
module.exports = promiseSleep;
```
npm package: @js-util/random-int
Description: Returns a random value between max (exclusive) and min (inclusive)
Author: picocreator
Latest version: 1.0.0

# Random Int

Returns a random int between the max (exclusive) and min (inclusive) bounds

# npm install

```.bash
npm install --save @js-util/random-int
```

# Example usage

```.js
// Importing the module
const randomInt = require("@js-util/random-int");

// Get some random value
let value = randomInt(0, 100);
```

# Its code

```.js
/**
 * Returns a random int between the min, and max bound
 * 
 * @param {int} min value to generate, inclusively (meaning its possible to return min)
 * @param {int} max value to generate, exclusively (meaning it never returns max, unless max == min)
 * 
 * @return {int} random int between max (exclusive) and min (inclusive)
 */
function randomInt(min, max) {
	min = Math.ceil(min);
	max = Math.floor(max);
	return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
}

// Export the function
module.exports = randomInt;
```
npm package: @js-util/tcp-failover-proxy
Description: Setup a TCP proxy server, with automated failover - note this is not a loadbalancing proxy.
Author: picocreator
Latest version: 1.0.10

# tcp-failover-proxy

Setup a TCP proxy server, with automated failover - note this is not a loadbalancing proxy.

| Option         | Default | Description                                           |
|----------------|---------|-------------------------------------------------------|
| port           |         | (required) TCP Proxy Server port                      |
| host           |         | TCP Proxy Server host binding (use null for all)      |
| backend        |         | (required) List of backend `host:port` paths to route |
| log            | true    | Enable console logging of proxy server setup          |
| shuffle        | false   | Shuffle's the backend list, prior to using it         |
| connectTimeout | 2500    | Connection timeout in milliseconds                    |

# npm install

```.bash
npm install --save @js-util/tcp-failover-proxy
```

# Future TODO

- ability to change out backend listing on demand
- ability to run this in a seperate child process `.fork` thread, while maintaining existing interface.

# Example usage

> PS: This is incomplete code, you will need to modify for your actual use case.

```.js
// Load the module
const TCPFailoverProxy = require("@js-util/tcp-failover-proxy);

// Create the failover proxy, with the desired settings
const proxy = new TCPFailoverProxy({

    // port to run server on
    port: 3128,

    // host to run on, this can be configured for security reasons
    host: 127.0.0.1,

    // backend list, of host to route to
    backend: [ "192.168.10.10:3128", "192.168.10.11:3128" ],

    // enable console logging
    log: true,

    // Shuffle backend list, useful to help distribute traffic
    // over a large list of backend's
    shuffle: false,

    // Connection timeout for a backend to fail
    connectTimeout: 2500

}, (proxyServer) => {

    // Do something with setup callback if you like

});
```
npm package: @js-util/two-way-socket-pipe
Description: Given two `net.Socket`, pipe their data stream in both direction
Author: picocreator
Latest version: 1.0.0

# two-way-socket-pipe

Given two `net.Socket`, pipe their data stream in both direction. 

This is useful when trying to build things like TCP proxies. 
It also automatically closes the opposite socket, when either end closes.

# npm install

```.bash
npm install --save @js-util/two-way-socket-pipe
```

# Example usage

> PS: This is incomplete code, you will need to modify for your actual use case.

```.js
// Load the module
const twoWaySocketPipe = require("@js-util/two-way-socket-pipe);

// Create the server with the socket listening event
const server = net.createServer(function (localsocket) {

	// Somehow get a remote socket connection
	let remotesocket = yourFunctionToGetRemoteSocketHere();
	
	// Lets connect the two sockets together
	// use true for the thrid parameter to enable verbose mode.
	// (aka easier to debug with console.log)
	twoWaySocketPipe(localsocket, remotesocket, true);

	// ...
});
```
npm package: @js-utilities/typecheck
Description: Utility library for javascript type checking.
Author: Vitalii Shapovalov
Latest version: 0.1.6

# Type checking library

[![npm version](https://badge.fury.io/js/%40js-utilities%2Ftypecheck.svg)](https://badge.fury.io/js/%40js-utilities%2Ftypecheck)
[![Build Status](https://travis-ci.org/vitalishapovalov/Typecheck.svg?branch=master)](https://travis-ci.org/vitalishapovalov/Typecheck)

A set of super-simple type checkers. Each checker returns `boolean` value. Most checkers are typescript [type predicates](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates).

## Installation

```bash
npm i -S @js-utilities/typecheck
```

## Usage example

```typescript
import { isCallable } from "@js-utilities/typecheck";

const a: unknown = global.value;

if (isCallable(a)) a();
```

## Available checkers:

| Checker              | Return type                    |
| -------------------- | -------------------------------|
| `isCallable`         | `boolean`                      |         
| `isFunction`         | `value is Function`            |         
| `isArrowFunction`    | `boolean`                      |         
| `isArray<T>`         | `value is T[]`                 |         
| `isObject<T>`        | `value is T`                   |         
| `isBoolean`          | `value is boolean`             |         
| `isUndefined`        | `value is undefined`           |            
| `isNumber`           | `value is number`              |         
| `isString`           | `value is string`              |         
| `isSymbol`           | `value is symbol`              |         
| `isNull`             | `value is null`                |   
| `isMap<T, U>`        | `value is Map<T, U>`           | 
| `isSet<T>`           | `value is Set<T>`              |     
| `isWeakSet<T>`       | `value is WeakSet<T>`          |         
| `isWeakMap<T, U>`    | `value is WeakMap<T, U>`       |    
| `isPromise<T>`       | `value is Promise<T>`          |    
    
## License

[MIT License](https://github.com/vitalishapovalov/Typecheck/blob/master/LICENSE)
npm package: @js-utils-kit/core
Description: Essential JavaScript helpers
Author: Sriman
Latest version: 4.0.0

# `@js-utils-kit/core`

_Modular JavaScript utilities with type support_

[![ci](https://github.com/teneplaysofficial/js-utils-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/TenEplaysOfficial/js-utils-kit)
[![codecov](https://codecov.io/github/teneplaysofficial/js-utils-kit/graph/badge.svg?token=9CEFGKSU2S)](https://github.com/TenEplaysOfficial/js-utils-kit)
[![npm version](https://img.shields.io/npm/v/@js-utils-kit/core.svg?logo=npm&color=brightgreen)](https://www.npmjs.com/package/@js-utils-kit/core)
[![Downloads](https://img.shields.io/npm/dt/@js-utils-kit/core?logo=npm)](https://www.npmjs.com/package/@js-utils-kit/core)

## Overview

**JS Utils Kit** is a compact and reliable library of essential JavaScript utility functions. It includes helpers for arrays, objects, numbers, promises, type checking, and more. Designed for performance and modularity, it integrates easily into JavaScript and TypeScript projects with minimal impact on bundle size.

This package includes utilities designed for both browser and Node.js environments, clearly organized and optimized for cross-platform compatibility.

## Installation

```sh
# via npm
npm install @js-utils-kit/core

# via yarn
yarn add @js-utils-kit/core

# via pnpm
pnpm add @js-utils-kit/core

# via bun
bun add @js-utils-kit/core
```

## Usage

```ts
import { capitalize, clamp, isBrowser, isEmpty, unique } from '@js-utils-kit/core';

console.log(clamp(150, 0, 100)); // 100
console.log(capitalize('hello world')); // 'Hello World'
console.log(unique([1, 2, 2, 3])); // [1, 2, 3]
console.log(isEmpty({})); // true
console.log(isBrowser()); // true/false
```

or

```ts
import * as kit from '@js-utils-kit/core';

console.log(kit.clamp(150, 0, 100)); // 100
console.log(kit.capitalize('hello')); // 'Hello'
console.log(kit.unique([1, 1, 2])); // [1, 2]
console.log(kit.isEmpty({})); // true
console.log(kit.isNode()); // true/false
```

## Documentation

Full documentation is available at [js-utils.js.org](https://js-utils.js.org/modules.html)

## Contributing

We welcome contributions whether it's fixing bugs, adding utilities, improving docs, or writing tests. See [CONTRIBUTING.md](../../../CONTRIBUTING.md) for guidelines and join our [GitHub Discussions](https://github.com/teneplaysofficial/js-utils-kit/discussions) to share ideas or propose features.

## License

Released under the [MIT License](../../../LICENSE)
npm package: @js-v1/excel
Description: excel导入导出工具包
Author: jswang
Latest version: 1.0.17

###安装
npm i @js-v1/excel

### 使用
import Xlsx from '@js-v1/excel'

const e = new Xlsx() //创建实例
e.SetMultiHeader([]) // 设置多级表头
e.SetHeader([]) // 设置表头
e.SetData([[]]) // 设置数据 二维数组
e.SetFilename('') // 设置表名
e.SetMerges([]) // 设置合并项
e.SetData([[]]) // 设置数据 二维数组
npm package: @js-vi/cli
Description: JS-VI poster generator CLI — render branded posters in PNG, SVG, PDF, GIF from templates.
Author: imjszhang
Latest version: 1.4.0

# @js-vi/cli

**JS-VI Poster Generator** — render branded posters in PNG, SVG, PDF, GIF from Neo-Brutalism templates via CLI or programmatic API.

## Install

```bash
# Global install (use as CLI tool)
npm install -g @js-vi/cli

# Or project-local
npm install @js-vi/cli
```

## CLI Usage

```bash
# Generate a poster
js-vi poster --template terminal --title "Hello World" -s dark -f png -o poster.png

# List available templates
js-vi templates

# Auto-fit title font size
js-vi poster --template card --title "Long Title Text" --auto-fit -f png -o out.png

# Balanced line wrapping + shrink-wrap width
js-vi poster --template cybertaoist --title "My Title" --balanced --shrink-wrap -f html -o out.html

# Batch generation from config
js-vi poster --config posters.json

# Measure text layout
js-vi measure --template terminal --title "My Title"

# Typeset analysis across sizes
js-vi typeset --template terminal --title "My Title"

# Find best poster size
js-vi best-size --template terminal --title "My Title"

# Lint text overflow in batch config
js-vi lint --config posters.json

# Scaffold a template plugin project
js-vi init my-project --template my-template

# Build design tokens (CSS + Tailwind preset)
js-vi build

# Start poster gallery with live reload
js-vi gallery
```

## Programmatic API

```js
import { renderToHTML, listTemplates } from '@js-vi/cli/templates'

// List all available templates
const templates = listTemplates()
console.log(templates.map(t => t.name))

// Render a poster to HTML
const html = await renderToHTML('terminal', {
  title: 'HELLO\\nWORLD',
  subtitle: '// subtitle',
}, { scheme: 'dark', size: 'a4', autoFit: true })
```

## Built-in Templates

| Template | Style | Best For |
|----------|-------|----------|
| `terminal` | Terminal/hacker aesthetic | Tech talks, dev events |
| `cybertaoist` | Cyberpunk + Eastern philosophy | Brand campaigns |
| `card` | Clean card layout | Social media sharing |
| `wechat-cover` | WeChat article cover | WeChat Official Accounts |

## Output Formats

| Format | Extension | Requires |
|--------|-----------|----------|
| HTML | `.html` | — |
| PNG | `.png` | Playwright |
| JPEG | `.jpg` | Playwright |
| SVG | `.svg` | Playwright |
| PDF | `.pdf` | Playwright |
| GIF | `.gif` | Playwright |

## License

MIT
npm package: @js-vi/tokens
Description: JS Visual Identity System — Neo-Brutalism design tokens, CSS variables, and Tailwind CSS preset.
Author: imjszhang
Latest version: 1.4.0

# @js-vi/tokens

**JS Visual Identity System** — Neo-Brutalism design tokens, CSS custom properties, and Tailwind CSS preset.

Zero dependencies. Framework-agnostic.

## Install

```bash
npm install @js-vi/tokens
```

## Usage

### Tailwind CSS Preset

```js
// tailwind.config.js
import jsViPreset from '@js-vi/tokens'

export default {
  presets: [jsViPreset],
  content: ['./src/**/*.{html,js,tsx}'],
}
```

### CSS Custom Properties

```css
@import '@js-vi/tokens/css/tokens.css';
@import '@js-vi/tokens/css/brutal.css';
```

```html
<div class="brutal-card">
  <h1 style="color: var(--js-color-brand-yellow)">Hello</h1>
</div>
```

### Programmatic Access (JS)

```js
import { colors, typography, spacing } from '@js-vi/tokens/tokens'

console.log(colors.brand.yellow.value)  // "#FCD228"
console.log(typography.fontFamily.sans)  // { value: ["Space Grotesk", "sans-serif"] }
```

## Design Tokens

| Token | Value |
|-------|-------|
| Brand Yellow | `#FCD228` |
| Brand Black | `#000000` |
| Brand White | `#FFFFFF` |
| Font Sans | Space Grotesk |
| Font Mono | JetBrains Mono |
| Shadow Brutal | `4px 4px 0px 0px #000000` |
| Border Width | `3px` |

## Exports

| Subpath | Description |
|---------|-------------|
| `@js-vi/tokens` | Tailwind CSS preset (default) |
| `@js-vi/tokens/tokens` | Raw design tokens as JS objects |
| `@js-vi/tokens/css/tokens.css` | CSS custom properties |
| `@js-vi/tokens/css/brutal.css` | Brutal component styles |
| `@js-vi/tokens/tailwind-preset` | Tailwind CSS preset (explicit) |

## License

MIT