open-index/open-npm huggingface dataset:
npm package: 3h-daemon
Description: A daemon lib.
Author: 3h
Latest version: 2.1.2

# 3h-daemon

A daemon lib.

# Usage

## In your command line

```
3h-daemon <command> [options]

    <command>              The command to execute.
                           Default: node

    -h, --help             Show help info.

    -e, --exec             Use `child_process.exec` instead
                           of `child_process.spawn`.

    -a, --args   <args...> The arguments passed to the command.

    -m, --max    <number>  Max restart times.
                           Default: Infinity

    -d, --delay  <number>  Restart delay.

    -t, --time   <format>  Time format.

    -s, --silent           Disable logs.

    --no-stderr            No stderr for the child process.

    --no-stdin             No stdin for the child process.

    --no-stdout            No stdout for the child process.

```

## In your app

See declaration files in [`typings`](typings) to learn the APIs.
npm package: 3h-event
Description: A well-typed event emitter.
Author: 3h
Latest version: 0.4.2

# 3h-event

> A well-typed event emitter.

## Links

- [Documentation](https://github.com/huang2002/3h-event/wiki)
- [Changelog](./CHANGELOG)
- [License (MIT)](./LICENSE)

## Example

```ts
import { Event, EventEmitter } from '3h-event';

const EVENT_B = Symbol('name of event b');

type EventA = Event<'name_of_event_a', DataTypeOfEventA>;
type EventB = Event<EVENT_B, DataTypeOfEventB>;

interface MyEvents {
    name_of_event_a: EventA;
    [EVENT_B]: EventB;
}

const eventEmitter = new EventEmitter<MyEvent>();

eventEmitter.on('name_of_event_a', (event) => {
    event.stop();
    // ...
});

eventEmitter.on(EVENT_B, (event) => {
    event.cancel();
    // ...
});

const eventA: EventA = new Event({
    name: 'name_of_event_a',
    data: dataA,
    stoppable: true,
});

eventEmitter.emit(eventA);

if (eventA.stopped) {
    // ...
}

const eventB: EventB = new Event({
    name: EVENT_B,
    data: dataB,
    cancelable: true,
});

eventEmitter.emit(eventB);

if (eventB.canceled) {
    // ...
}
```
npm package: 3h-iter
Description: An iteration lib.
Author: 3h
Latest version: 0.9.1

# 3h-iter

> An iterator lib.

## Introduction

`3h-iter` is an iterator library that provides useful iterator-related helpers,
such as `map`, `range`, `chain`, `zip` and so on.
It is recommanded to use `3h-iter` with ES2015+ syntax.

## Example Usage

```js
import { range, zip } from '3h-iter';

for (const i of range(5)) {
    console.log(i);
}
// Prints 0 through 4 in console.

const numbers = [0, 1, 2];
const strings = ['a', 'b', 'c'];
for (const tuple of zip(numbers, strings)) {
    console.log(tuple);
}
// Prints the following tuples:
// [ 0, 'a' ]
// [ 1, 'b' ]
// [ 2, 'c' ]
```

## Links

- [API Reference](https://github.com/huang2002/3h-iter/wiki)
- [Changelog](./CHANGELOG.md)
- [License (MIT)](./LICENSE)
npm package: 3h-join
Description: A stream body parser.
Author: 3h
Latest version: 2.0.0

# 3h-join

A stream body parser.

# Example

```javascript
const join = require('3h-join');

function callback(err, data) {
    if (err) {
        console.error('Error while reading stream: ', err);
    } else {
        console.log(`Received: ${JSON.stringify(data)}`);
    }
}

join.text({ stream: textStream }, callback);

join.json({
    stream: jsonStream,
    // parser: myJSONParser
}, callback);

join.form({
    stream: formStream,
    // parser: myFormParser
}, callback);

```

# APIs

See [`the declaration file`](typings/index.d.ts) to learn the APIs.
npm package: 3h-localizer
Description: A utility lib for localization in vue.
Author: hhh
Latest version: 0.2.0

# 3h-localizer

> A utility lib for localization in vue.

## Example Usage

The following code creates a demo page
containing a title and a select input,
where the content of the title
is controlled by selected language.

```vue
<template>
    <h1>{{ dict.HELLO_WORLD }}</h1>
    <select v-model="language">
        <option value="zh">中文</option>
        <option value="en">English</option>
    </select>
</template>

<script setup lang="ts">
import { Localizer, translationsToDicts, type Translations } from '3h-localizer';

type MyDict = {
    HELLO_WORLD: string;
};

type MyLanguages = 'zh' | 'en';

const translations: Translations<MyDict, MyLanguages> = {
    HELLO_WORLD: {
        zh: '你好，世界！',
        en: 'Hello, world!',
    },
};

const localizer = new Localizer<MyDict, MyLanguages>({
    defaultLanguage: 'en',
    dicts: translationsToDicts(translations),
});

const { language, dict } = localizer;
</script>
```

## Links

- [API Reference](https://github.com/huang2002/3h-localizer/wiki)
- [Changelog](./CHANGELOG.md)
- [License (MIT)](./LICENSE)
npm package: 3h-log
Description: A logger lib.
Author: 3h
Latest version: 3.1.2

# 3h-log

A logger lib.

# Features

- Log with formatted time stamps (using `3h-time`)
- Log with various prefixes
- Log level control

# Example

```javascript

const Logger = require('3h-log'),
    logger = new Logger({ timeFormat: '[YYYY-MM-DD HH:mm:SS.sss]' });

logger.print('custom', 'Custom messages.');

logger.setLevel('log');

logger.error('Some errors.');
logger.warn('Some warnings.');
logger.info('Some infomation.');
logger.log('Some logs.');
logger.debug('This should not be seen!');

```

# APIs

Just read the type declaration files in [`typings`](typings) to learn the APIs.
npm package: 3h-pool
Description: A simple object pool lib.
Author: 3h
Latest version: 0.1.0

# 3h-pool

> A simple object pool lib.

## API Reference

```typescript
// Access the APIs via `require('3h-pool')`
// or `HP.*`(UMD namespace).
export as namespace HP;

/**
 * Type of pool creators.
 */
export declare type PoolCreator<T> = () => T;

/**
 * Type of pool processors.
 */
export declare type PoolProcessor<T> = (object: T) => void;

/**
 * Type of pool options.
 */
export interface PoolOptions<T> {

    /**
     * The creator of objects.
     */
    create: PoolCreator<T>;

    /**
     * The initializer of objects,
     * which will be invoked to initialize
     * objects that will be returned by `pop`.
     */
    init?: PoolProcessor<T> | null;

    /**
     * The cleaner of objects,
     * which will be invoked to clear
     * objects that are received by `push`.
     */
    clear?: PoolProcessor<T> | null;

    /**
     * The initial pool size.
     * (`prepare(initSize)` will be executed.)
     */
    initSize?: number;

}

/**
 * Class of object pools.
 */
export declare class Pool<T> {

    /**
     * Constructor {@link Pool}.
     */
    constructor(options: PoolOptions<T>);

    /**
     * Creator of objects.
     */
    create: PoolCreator<T>;

    /**
     * The initializer of objects,
     * which will be invoked to initialize
     * objects that will be returned by `pop`.
     */
    init: PoolProcessor<T> | null;

    /**
     * The cleaner of objects,
     * which will be invoked to clear
     * objects that are received by `push`.
     */
    clear: PoolProcessor<T> | null;

    /**
     * Internal pool.
     */
    pool: T[];

    /**
     * Prepare specific amount of objects in the pool.
     */
    prepare(count: number): void;

    /**
     * Get an object from the pool.
     */
    pop(): T;

    /**
     * Put an object into the pool. (recycle)
     */
    push(object: T): void;

}
```
npm package: 3h-random
Description: A randomizer lib.
Author: 3h
Latest version: 2.0.0

# 3h-random

> A randomizer lib.

## Usage

```javascript
/**
 * Employ one of the following to import this lib
 * or access the global namespace `HRandom` directly
 * if you are using it as a UMD module.
 * - import HRandom from '3h-random';
 * - const HRandom = require('3h-random');
 */

const randomizer = new HRandom.Randomizer({
    // seed: ...
    // cursor: ...
    // m: ...
    // a: ...
    // b: ...
});

console.log(randomizer.float(0, 1));
console.log(randomizer.integer(0, 100));

randomizer.reset(seed, cursor);

console.log(randomizer.boolean(0.5));
console.log(randomizer.string(16));
console.log(randomizer.choice(choices));
```

## Links

- [API Reference](https://github.com/huang2002/3h-random/wiki)
- [Changelog](./CHANGELOG.md)
- [License (MIT)](./LICENSE)
npm package: 3h-refactor
Description: A refactor lib.
Author: 3h
Latest version: 1.2.1

# 3h-refactor

A refactor lib.

# Functionality

- Find the reference(s) to the src file.
- Automatically change the import/export statement(s) while moving the src file.

# Support info

Here is some support info. Please note that this is the default support info, and you can customize the patterns by modifying the regular expression arrays.

## Statements

The lib supports most common import/export statements out of the box.

- `import { ... } from "...";`
- `import * from "...";`
- `import * as ___ from "...";`
- `export { ... } from "...";`
- `export * from "...";`
- `import ___ = require("...");`
- `require("...")`
- `<script src="..."></script>`

## File formats

Files with following extensions are included by default.

- `.js`
- `.jsx`
- `.mjs`
- `.json`
- `.ts`
- `.tsx`
- `.html`
- `.htm`

# Usage

## In your command line

```
Usage:
  3h-refactor              - Show help info like this.
  3h-refactor <src>        - Show reference(s) to src file.
  3h-refactor <src> <dist> - Change src file to dist file.
```

## In your app

Just read the declaration files in [`typings`](typings) to learn the APIs.
npm package: 3h-router
Description: A simple router.
Author: 3h
Latest version: 2.0.5

# 3h-router

A simple router lib.

# Features

- Gzip/Deflate support
- Main router and sub-routers

# Example

## main router

```javascript

const Router = require('3h-router'),
    router = new Router({ basePath: __dirname });

// You can get default values via Router.defaultOptions.
router.defaultPages.unshift('my-default-page.html');
router.subRouters.unshift('my-sub-router.js');

router.on('before', url => {
    console.log(`[before] ${url}`);
    // If there's any `before` event handler, then
    // the routing will pause here, so remember to
    // call router.route to continue the routing.
    // In addition, if you want to forward the
    // request, then just pass the target url.
    router.route(url);
}).on('result', result => {
    console.log(`[result] ${result.code}`);
}).on('error', err => {
    console.log('An error occurred!');
    console.error(err);
}).start(88);

console.log('Server started on port 88!');

```

## sub-router

```javascript

module.exports = router => {
    const { response } = router;
    response.writeHead(200, {
        'Content-Type': 'text/html'
    });
    response.end('<h1>Generated by sub-router!</h1>');
};

```

# APIs

Just read the declaration files in [`typings`](typings) to learn the APIs.
npm package: 3h-server
Description: A cli server lib.
Author: 3h
Latest version: 1.0.9

# 3h-server

A cli server lib.

# Usage

```
3h-server  [options]

    -h, --help                  Show help info.

    -p, --port      <port>      The port to listen on.
                                Default: 80

    -l, --log                   Log request urls.

    -r, --result                Log request results.

    -e, --err                   Log errors.

    -t, --time      <format>    Time format.

    --default-pages <files...>  Additional default pages.

    --sub-routers   <files...>  Additional sub-routers.

```
npm package: 3h-sever
Description: A cli sever lib.
Author: 3h
Latest version: 1.0.6
Deprecated: 'Please

# 3h-sever
> A cli sever lib.

## Install
```
$ npm install 3h-sever -g
```

## Help
```
$ 3h-sever -h
Start a sever in current directory.

3h-sever <port> [options]

    <port>           The port to listen on.
    -h               Show help info.
    -ne              No error logs for the router.
    -lp              Log pathes before routing.
    -dp    <files>   Default pages.
    -sr    <files>   Sub-router files.
    -pf    <files>   Private files.
    -pd    <dirs>    Private directories.

```
npm package: 3h-term
Description: A terminal simulator in browser.
Author: 3h
Latest version: 0.1.2

# 3h-term

> A terminal simulator in browser.

## Links

- [API Reference](https://github.com/huang2002/3h-term/wiki)
- [License (MIT)](./LICENSE)

## Example

```html
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>3h-term example</title>
</head>

<body>
    <script type="text/javascript" crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/super-x@1.0.0/dist/super-x.umd.min.js"></script>
    <script type="text/javascript" crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/3h-term@0.1.0/dist/3h-term.umd.min.js"></script>
    <script>

        const handlers = new Map([
            ['echo', input => {
                terminal.writeln(`"${input}"`);
            }],
            ['clear', () => {
                terminal.clear();
            }],
        ]);

        const terminal = new T.Terminal(
            {
                margin: '1em auto',
                width: '480px',
                height: '320px',
                fontSize: '16px',
                borderRadius: '5px',
            },
            T.createProgram(handlers, input => {
                terminal.writeln(`Unknown operation: ${input}`);
            })
        );

        document.body.appendChild(terminal.container);

        terminal.write('This is an example of ')
            .write('3h-term', {
                color: '#FFF',
                fontWeight: 'bold',
            })
            .write('.')
            .writeln();

    </script>
</body>

</html>
```
npm package: 3h-test
Description: A simple test lib.
Author: 3h
Latest version: 0.10.0

# 3h-test

> A simple test lib.

## Links

- [API Reference](https://github.com/huang2002/3h-test/wiki)
- [Changelog](./CHANGELOG.md)
- [License (MIT)](./LICENSE)

## Example

```js
const T = require('3h-test');

T.test({ // default context options
    timeout: 1000,
}, { // test cases

    strictEqual(context) { // test case 0
        context.assertStrictEqual(1 + 2, 3);
    },

    promise(context) { // test case 1
        context.expectResolved(
            somePromise,
            'label',
            data => {
                // extra check on the data...
            }
        );
    },

});
```
npm package: 3h-time
Description: A time formatter.
Author: 3h
Latest version: 1.2.1

# 3h-time

A time formatter.

# Install

```
npm i 3h-time
```

# APIs

## Time.format(date: Date, format: string): string

Format the given date.

## Time.get(format: string):string

Equal to `Time.format(new Date(), format)`.

## Time.replacers: { [id: string]: (date: Date) => string; }

A replacer map.

# Replace map

- `YYYY` - Full year.
- `YY` - Short year.
- `MMMM` - Full month name.
- `MMM` - Short month name.
- `MM` - Month number with leading zero.
- `M` - Month number without leading zero.
- `DD` - Date number with leading zero.
- `D` - Date number without leading zero.
- `dd` - Date number with st/nd/rd/th and leading zero.
- `d` - Date number with st/nd/rd/th but without leading zero.
- `HH` - Hour(0-23) with leading zero.
- `H` - Hour(0-23) without leading zero.
- `hh` - Hour(0-11) with leading zero.
- `h` - Hour(0-11) without leading zero.
- `mm` - Minutes with leading zero.
- `m` - Minutes without leading zero.
- `SS` - Seconds with leading zero.
- `S` - Seconds without leading zero.
- `sss` - Full milliseconds with leading zero.
- `ss` - Shorter milliseconds.
- `s` - Shortest milliseconds.
- `WW` - Full day name.
- `W` - Short day name.
- `ww` - Full day number.
- `w` - Short day number.
- `A` - AM/PM.
- `a` - am/pm.

# Changelog

See [CHANGELOG.md](Changelog.md).
npm package: 3h-validate
Description: A runtime validator.
Author: hhh
Latest version: 0.8.2

# 3h-validate

> A runtime validator.

## Links

- [API Reference](https://github.com/huang2002/3h-validate/wiki)
- [Changelog](./CHANGELOG.md)
- [License (MIT)](./LICENSE)

## Examples

### Type Validation

```js
import { types } from '3h-validate';
// or: const { types } = HV;

const validator = types.number({
    integersOnly: true,
    min: 0,
    includeMin: false,
});

if (validator.test(1)) {
    console.log('1 is a valid value.');
}

validator.validate(0); // RangeError: the number is too small
```

### Versioned Data Management

```js
import { types, Specification } from '3h-validate';
// or: const { types, Specification } = HV;

const spec1 = new Specification({
    version: 'v1',
    validator: types.number(),
});

const spec2 = new Specification({
    version: 'v2',
    validator: types.string(),
    previousSpecification: spec1,
    updater: String,
});

const versionedData = {
    version: 'v1',
    data: 3.14,
};

console.log(spec1.test(versionedData)); // true

console.log(spec2.transform(versionedData));
// { version: 'v2', data: '3.14' }
```
npm package: 3h-version
Description: A package version manager.
Author: 3h
Latest version: 1.4.8

# 3h-version

A package version manager.

# Install

Install it as a cli tool.

```
> npm i 3h-version -g
```

# Usage

```
> 3h-version -h
A package version manager.

3h-version  [options]

  -h, --help                  Show this help info.

  -f, --file      <file>      The file to operate on.
                              Default: package.json

  -e, --enc       <encoding>  The encoding of the file.
                              Default: utf8

  -g, --get                   Get current version.

  -s, --set       <version>   Set the version.

  -c, --chk                   Check current version.

  -i, --inc       <level>     Increase the version by <level>,
                              where <level> is "major",
                              "minor" or "patch"(default).

  -p, --pre       <tag>       Pre-release tag. (If this arg
                              appears, but the <tag> is not
                              specified, then the <tag> will
                              be "beta".)

  -t, --tab-size  <size>      The tab size. (Default: 4)

  -l, --log       <logs>      Changelogs. (e.g. -l "..." "...")
                              If this arg is followed by nothing,
                              then changelogs will be read from
                              the command line.

  --log-file      <file>      The changelog file.
                              Default: CHANGELOG.md

  --time-format   <format>    Time format passed to `3h-time`.
                              Default: YYYY-MM-DD

  --heading-gap   <gap>       Heading gap. (Default: " - ")

```
npm package: 3id-provider
Description: 3ID Provider Library
Author: Pedro Gomes
Latest version: 1.6.1

# 3id-provider [![npm version](https://badge.fury.io/js/3id-provider.svg)](https://badge.fury.io/js/3id-provider)

3ID Provider Library

## Example

```javascript
import ThreeIdProvider from '3id-provider';

const connection: IRpcConnection

const provider = new ThreeIdProvider(connection);

await provider.enable();
```
npm package: 3id-resolver
Description: Resolve 3ID documents
Author: 3box
Latest version: 1.0.1
Deprecated: Deprecated in favor of Ceramic: https://developers.ceramic.network

# 3ID Resolver

This library is intended to resolve 3ID DID documents. 3ID is a thin identity protocol that uses ipfs and ethereum to publish and rotate the cryptographic keys used by an identity.

It supports the proposed [Decentralized Identifiers](https://w3c-ccg.github.io/did-spec/) spec from the [W3C Credentials Community Group](https://w3c-ccg.github.io).

It requires the `did-resolver` library, which is the primary interface for resolving DIDs.

## Resolving a DID document

A 3ID resolver is created by passing an IPFS instance to the `getResolver()` function. To use the resolver returned, it must be passed to a `did-resolver` instance during instantiation, for example:

```js
import { Resolver } from 'did-resolver'
import { getResolver } from '3id-resolver'

const threeIdResolver = getResolver(ipfs)
const resolver = new Resolver(threeIdResolver)

resolver.resolve('did:3:QmRhjfL4HLdB8LovGf1o43NJ8QnbfqmpdnTuBvZTewnuBV').then(doc => console.log)

// You can also use ES7 async/await syntax
const doc = await resolver.resolve('did:muport:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf')
```

See the [did-resolver docs](https://github.com/decentralized-identity/did-resolver) for more general usage information on DID resolvers.

Result:
```js
{
  '@context': 'https://w3id.org/did/v1',
  id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf',
  publicKeys: [ {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#signingKey',
    type: 'Secp256k1VerificationKey2018',
    publicKeyHex: '03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479'
  }, {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#encryptionKey',
    type: 'Curve25519EncryptionPublicKey',
    publicKeyBase64: 'fake encryptionKey'
  }, {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#managementKey',
    type: 'Secp256k1VerificationKey2018',
    ethereumAddress: 'fake eth addr'
  }],
  authentication: [{
    type: 'Secp256k1SignatureAuthentication2018',
    publicKey: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#signingKey'
  }]
}
```

## Maintainers
[@oed](https://github.com/oed)
npm package: 3il_edt
Description: retrieve schedules from EDT 3iL
Author: Ali CAN
Latest version: 1.1.0
Deprecated: no longer maintained

# 3iL EDT
This tool allow you to retrieve schedules of 3iL EDT.

The project consists of representing the timetable of a school, 3iL Ingénieurs, using objects that contain information about the courses and classrooms for each day of the week. The data is stored in a structured and easily accessible format, making it easy to integrate into your development projects.

[Link to npm package](https://www.npmjs.com/package/3il_edt)

## Installation
To use this library you must __install__ it into your Node JS project.

Install the library this way :
```console
npm i 3il_edt
```
## Use
Use like that :
```javascript
var { Timetable } = require('3il_edt');

(async () => {
    var link_edt = "https://eleves.groupe3il.fr/edt_eleves/00_index.php?idGroupe=CPI1%20Groupe%201.xml" //put your own class link

    var timetable = new Timetable(link_edt)
    await timetable.create_weeks()

    console.log(myTimetable.weeks[0]);
})();
```

You will get a scheme like this of a single week :

```javascript
Week {
    number: '04',
    year: '23',
    last_update: 'MAJ le : 23/01/23 à 15:36:28',
    raw_dates: [
        '23-01-2023',
        '24-01-2023',
        '25-01-2023',
        '26-01-2023',
        '27-01-2023'
    ],
    daily_timetable: [ [Array], [Array], [Array], [Array], [Array] ],
    daily_rooms: [ [Array], [Array], [Array], [Array], [Array] ],
    iso_dates: [
        2023-01-22T23:00:00.000Z,
        2023-01-23T23:00:00.000Z,
        2023-01-24T23:00:00.000Z,
        2023-01-25T23:00:00.000Z,
        2023-01-26T23:00:00.000Z
    ]
}
```

## Build With
This tool was built with the libraries __Cheerio__ (web-scrapping library) and __Fetch__.

## Project : [3iL EDT Project]()
- [3iL EDT API]()
npm package: 3in1-package
Description: A sample npm package with a service worker.
Author: Your Name
Latest version: 1.4.0

# My NPM Package

This package provides a service worker implementation that can be used in web applications to manage caching and network requests.

## Installation

To install the package, use npm:

```
npm install my-npm-package
```

## Usage

To use the service worker in your project, register it in your main JavaScript file:

```javascript
if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/path-to-your-service-worker.js')
        .then((registration) => {
            console.log('Service Worker registered with scope:', registration.scope);
        })
        .catch((error) => {
            console.error('Service Worker registration failed:', error);
        });
}
```

Make sure to replace `/path-to-your-service-worker.js` with the actual path to the service worker file.

## API

### Public Methods

- **methodName**: Description of the method and its usage.

## License

This project is licensed under the MIT License. See the LICENSE file for details.